|
View previous topic :: View next topic
|
| Author |
Message |
Vignesh Sid
New User
Joined: 04 Sep 2017 Posts: 43 Location: India
|
|
|
|
Hi all,
I have the following file:
File 1:
| Code: |
"STARTOFDATA","FILE_GENERATION_TIMESTAMP={20171025_004001_EST};APPLICATION_MNEMO
"ENDOFDATA","RECORDCOUNT={115501};PRINCIPAL_RECORDCOUNT={0};GROUP_RECORDCOUNT={7998
|
File2:
| Code: |
"STARTOFDATA","FILE_GENERATION_TIMESTAMP={20171026_004001_EST};APPLICATION_MNEMO
"ENTITLEMENT","PERSON","50027SCOTT23","50027SCOTT23","ACCOUNT RECON","RESOURCE",
"ENTITLEMENT","PERSON","50027VIKK123","50027VIKK123","ACCOUNT RECON","RESOURCE",
"ENDOFDATA","RECORDCOUNT={115501};PRINCIPAL_RECORDCOUNT={0};GROUP_RECORDCOUNT={8000 |
Both the files are of same record length 850 and FB. I need to write the unmatched records in file 2 to a PS. Here we can see the time stamp, two additional records and record count differs.
| Code: |
//SORTTSC EXEC PGM=SORT
//SORTJNF1 DD DSN=G0435V00,DISP=SHR
//SORTJNF2 DD DSN=G0436V00,DISP=SHR
//UNMATCH DD DSN=UNMATCH,
// DISP=(OLD,CATLG,CATLG),
// UNIT=,
// DATACLAS=TST090P5,
// DCB=(LRECL=850,BLKSIZE=0,RECFM=FBS),
// SPACE=
//SYSOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
JOINKEYS F1=SORTJNF1,FIELDS=(1,850,A)
JOINKEYS F1=SORTJNF1,FIELDS=(1,850,A)
JOINKEYS F2=SORTJNF2,FIELDS=(1,850,A)
JOIN UNPAIRED,F2,ONLY
OUTFIL FNAMES=UNMATCH,BUILD=(1,850)
/* |
I used the above JCL and got the below output:
| Code: |
"ENDOFDATA","RECORDCOUNT={115501};PRINCIPAL_RECORDCOUNT={0};GROUP_RECORDCOUNT={8
"ENTITLEMENT","PERSON","50027SCOTT23","50027SCOTT23","ACCOUNT RECON","RESOURCE",
"ENTITLEMENT","PERSON","50027VIKK123","50027VIKK123","ACCOUNT RECON","RESOURCE",
"STARTOFDATA","FILE_GENERATION_TIMESTAMP={20171026_004001_EST};APPLICATION_MNEMO
|
I have got the unmatched records, but the start and end records are swapped.
Can anyone help me with this sort?
Thanks!
CODE' D |
|
| Back to top |
|
 |
enrico-sorichetti
Superior Member

Joined: 14 Mar 2007 Posts: 10903 Location: italy
|
|
|
|
why did You post into the JCL section when there are specific section for the sort questions?
tell what sort product You are using and the topic will be moved to the proper section
messages starting with
WER... ==> SYNCSORT
ICE... ==> IBM DFSORT |
|
| Back to top |
|
 |
Vignesh Sid
New User
Joined: 04 Sep 2017 Posts: 43 Location: India
|
|
|
|
We use syncsort. Sorry for the inconvenience caused!
Thanks! |
|
| Back to top |
|
 |
enrico-sorichetti
Superior Member

Joined: 14 Mar 2007 Posts: 10903 Location: italy
|
|
|
|
| moved! |
|
| Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2286 Location: USA
|
|
|
|
| Vignesh Sid wrote: |
I have got the unmatched records, but the start and end records are swapped.
Can anyone help me with this sort? |
Your JOINKEYS statements do not specify SORTED option. That's why the sort utility performs its internal sort before attempting to join both inputs (FYI: there is no other way to join long files unless they are either sorted, or assumed to be sorted).
When just adding SORTED option you'll get the error "Fx FILE IS NOT SORTED", or similar.
You can try to play with the options "SORTED,NOSEQCK" but the desired output is not guaranteed since the input comes in random order.
Another method:
1) re-number input records from F2 on input (using //CTL2CNTL DD),
2) then SORT by this sequenced field after JOIN (to restore the original order), and
3) finally truncate this field in either OUTREC, or OUTFIL statement. |
|
| Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2286 Location: USA
|
|
|
|
A typo in my previous message:
It must be //JNF2CNTL DD instead of //CTL2CNTL DD
Sorry for that |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|