"Jack Kingsley" <jkin...@wmfinance.com> a écrit dans le message de news:
ce2fab65.02120...@posting.google.com...
I have tried that and don't have much luck, I can get it to work
though if I build a logical over it though. Any other ideas.
When adding a record in a keyed PF, DB2 automatically "sorts" the record
among the file.
Don't worry about its actual location in the file.
A single DSPPFM command shows records in arrival sequence even though the
file is sorted by keys.
However this PF is read in the key-order sequence when used in any program.
You can use keys in a any PFs and LFs.
You can even use a keyed LF pointing to a keyed PF sequenced by different
keys.
Where's the problem ?
> That's impossible or I don't understand the problem you get.
> Explain it again or show us what you already did.
>
> When adding a record in a keyed PF, DB2 automatically "sorts" the record
> among the file.
> Don't worry about its actual location in the file.
> A single DSPPFM command shows records in arrival sequence even though the
> file is sorted by keys.
> However this PF is read in the key-order sequence when used in any program.
Hmmm, not quite *any* program. In RPG at least it is possible on an
F-spec to specify arrival-sequence access. The CRTPF and CRTLF commands
to have a parameter "Force keyed access path", but I have never thought
of using it.
> You can use keys in a any PFs and LFs.
> You can even use a keyed LF pointing to a keyed PF sequenced by different
> keys.
If for some reason (what might it be?) you really want the records
physically sorted by key, you can use RGZPFM.
>
> Where's the problem ?
Where, indeed?
A R CALENDR
A MMDDYY 8 COLHDG('DAYSOFYEAR-MMDDYYYY')
A TEXT('DAYSOFYEAR-MMDDYYYY')
A HOL 1 COLHDG('HOLIDAY')
A TEXT('HOLIDAY')
A ME 1 COLHDG('MONTHEND')
A TEXT('MONTHEND')
A EMPDE 1 COLHDG('EMPTY DAYEND')
A TEXT('EMPTY DAYEND')
A K MMDDYY DESCEND
Here is what is looks like when I DSPPFM against it or query it:
File . . . . . . : YEAR2004 Library . . . . : QGPL
Member . . . . . : YEAR2004 Record . . . . . : 1
Control . . . . . Column . . . . . : 1
Find . . . . . . .
*...+....1.
02282003 M
01312003 M
> A K MMDDYY DESCEND
^^^^^^^
if you want ascending order omit the "DESCEND" keyword
ascending is the default
hth
Rolf
--
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*
! Dipl.Inf.(FH) Rolf P Mittag IBM Partner in Development !
! Leipziger Str. 50 D-69214 Eppelheim !
! Fon: +49 (6221) 76 78 60 Fax: +49 (6221) 76 80 26 !
! eMl: r...@r-m-e-d-v.de !
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*
Well, DSPPFM is short for Display *Physical* File Member. It always
shows records in physical sequence. To see records ordered by key, you
could say CPYF YEAR2004 *PRINT.
If you want Query or any of its friends to show records in a particular
sequence, you *must* specify that sequence. Without such a
specification, Query will return records in the sequence which is
easiest. Even if this happens so far to be the sequence you want, a
change in the number of records in the file or the distribution of
values in a field or the number of processors in your iSeries may change
the output sequence.
BTW, now I am *really* curious. What do you want this sequence for?
I should have said "this PF can be read in the key-order ..." but this is
not the subject of the post and anyway rarely used.
| A HOL 1 COLHDG('HOLIDAY')
| A ME 1 COLHDG('MONTHEND')
| A EMPDE 1 COLHDG('EMPTY DAYEND')
|| A K MMDDYY DESCEND
|
| Here is what is looks like when I DSPPFM against it or query it:
|
| File . . . . . . : YEAR2004 Library . . . . : QGPL
| Member . . . . . : YEAR2004 Record . . . . . : 1
| Control . . . . . Column . . . . . : 1
| Find . . . . . . .
| *...+....1.
| 02282003 M
| 01312003 M
This is the normal results of a DSPPFM command (discussed above).
The "02282003 M" rcd has been physically inserted first in the PF, then the
"01312003 M" rcd. They have been inserted *by chance* in the access path
sequence (descending on MMDDYY).
If this PF is read say in a CL program, you'd see that 1st rcd read is
02282003 M and then 01312003 M as well accordingly to the key-sequenced
access path.
If the 3rd record physically inserted was supposedly something like
"03152003 M", the DSPPFM would show now this rcd as the 3rd and the CL
program as the 1st one.
HTH
Phil
Do NOT use a DSPPFM command to check out if the records are sorted in the
desired order.
The DSPPFM command always shows the records in arrival sequence even though
they are sequenced by key(s). It's a performance matter.
Check out my previous posts.
Phil
As I enter dates into this file I might miss some and have to go back
and either enter new ones or change the exisiting one, want to have
them in order.
You have your records in arrival sequence and you have them in order of
MMDDYYYY because your field is MMDDYYYY. If you want them in YYYYMMDD order,
you have to change the date format of the field to YYYYMMDD.
--
"Jack Kingsley" <jkin...@wmfinance.com> a écrit dans le message de news:
ce2fab65.02121...@posting.google.com...
> Terrence Enger <ten...@idirect.com> wrote in message
news:<3DF6B95C...@idirect.com>...
[snip}
>>>>>
>>>Ok, here is the physical file:
>>>
>>>A R CALENDR
>>>A MMDDYY 8 COLHDG('DAYSOFYEAR-MMDDYYYY')
>>>A TEXT('DAYSOFYEAR-MMDDYYYY')
>>>A HOL 1 COLHDG('HOLIDAY')
>>>A TEXT('HOLIDAY')
>>>A ME 1 COLHDG('MONTHEND')
>>>A TEXT('MONTHEND')
>>>A EMPDE 1 COLHDG('EMPTY DAYEND')
>>>A TEXT('EMPTY DAYEND')
>>>A K MMDDYY DESCEND
[snip]
>>
>>BTW, now I am *really* curious. What do you want this sequence for?
>>
>
>
> As I enter dates into this file I might miss some and have to go back
> and either enter new ones or change the exisiting one, want to have
> them in order.
>
Yes, but as that order is mixed up with respect to the dates
represented, I am wondering what the order is good for.
"Jack Kingsley" <jkin...@wmfinance.com> wrote in message
news:ce2fab65.02121...@posting.google.com...