Jcl sort using join keys and reformat fields



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

Jcl sort using join keys and reformat fields

Postby raj » Mon Jan 14, 2008 5:31 pm

I want to compare 2 sorted files on a particular field and write the unmatched records of the first file in the 3rd output file. how can I do it using jcl sort card and using join keys and reformat fields?
The sample files are
File A
123 rohan mumbai
234 sanu chennai
456 aaaa delhi

File B
123 d23 1234.60
345 d45 1456.90
456 d67 3456.00


output file
234 sanu chennai
raj
 
Posts: 1
Joined: Mon Jan 14, 2008 3:45 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Jcl sort using join keys and reformat fields

Postby arunprasad.k » Wed Jan 16, 2008 5:16 pm

Raj,

Here you go!!

//STEP1   EXEC  PGM=SYNCSORT                                           
//SORTJNF1 DD *                                                         
123 ROHAN MUMBAI                                                       
234 SANU CHENNAI                                                       
456 AAAA DELHI                                                         
//SORTJNF2 DD *                                                         
123 D23 1234.60                                                         
345 D45 1456.90                                                         
456 D67 3456.00                                                         
//SORTOUT  DD SYSOUT=*                                                 
//SYSPRINT DD SYSOUT=*                                                 
//SYSOUT   DD SYSOUT=*                                                 
//SYSIN    DD *                                                         
 JOINKEYS FILE=F2,FIELDS=(1,3,A)                                       
 JOINKEYS FILE=F1,FIELDS=(1,3,A)                                       
 JOIN UNPAIRED,F1,ONLY                                                 
 REFORMAT FIELDS=(F1:1,80)                                             
 SORT FIELDS=COPY                                                       
/*                                                                     


PS: I do NOT have SYNCSORT in my shop, so this is an untested version. Hope this works.

Let me know if you have any questions.

Arun.
arunprasad.k
 
Posts: 110
Joined: Thu Dec 27, 2007 5:18 pm
Has thanked: 0 time
Been thanked: 0 time


Return to JCL

 


  • Related topics
    Replies
    Views
    Last post