Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Join in SORT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
kumarks

New User


Joined: 25 Nov 2008
Posts: 2
Location: chennai

PostPosted: Tue Jul 07, 2009 4:59 pm    Post subject: Join in SORT
Reply with quote

Both of my input files are of length 25. Both are fixed block files.

My record structure is like this.

File 1:
0000000000000012345678911
0000000000000023456789913
0000000000000023466789921

File 2:
0000000000000012456738914
0000000000000023456789929
0000000000000033456789922

The first 23 bytes is a employee number field. Next two bytes is pay code.

Now i want to the common records (key field is emp number) alone. The second record is common in both the files. Now i want the output record in below format.

Output:
000000000000002345678991329

Here first 23 bytes is the employee number and next two bytes (24,25) are pay code from file 1 and next two bytes (26,27) are pay code from file 2.
Back to top
View user's profile Send private message

Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue Jul 07, 2009 9:00 pm    Post subject:
Reply with quote

Kumarks,

The following DFSORT JCL will give you the desired results using when=group function. Simply concatenate the 2 files to sortin and sort on the key. And we push the contents of key on to the second record using when=group and only select those records. I assumed that your input keys are unique. We can modify the job to handle the duplicates also.

Code:

//STEP0100 EXEC PGM=SORT                                           
//SYSOUT   DD SYSOUT=*                                             
//SORTIN   DD DSN=S1S3.BEN.PAID.ASSOC.DATA.SORT,DISP=SHR
//         DD DSN=S1S3.BEN.ASSOIDT.UNLD.DATA.SORT,DISP=SHR
//SORTOUT  DD DSN=S1S3.BEN.PAID.ASSOIDT.DATA.SORT,
//            DISP=(NEW,CATLG,DELETE),
//            UNIT=SYSDA,
//            SPACE=(CYL,(60,20),RLSE)                         
//SYSIN    DD *                                                     
  SORT FIELDS=(1,23,CH,A)                                           
  OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(28:SEQNUM,8,ZD,RESTART=(1,23))),
  IFTHEN=(WHEN=GROUP,BEGIN=(28,8,ZD,EQ,1),PUSH=(26:24,2),RECORDS=2)
                                                                   
  OUTFIL INCLUDE=(28,8,ZD,EQ,2),BUILD=(1,23,X,24,2,X,26,2)         
/*
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts JOINKEYS Paired and Unpaired Sort MFwhiz DFSORT/ICETOOL 4 Fri Sep 29, 2017 1:48 am
No new posts Difference in SORT & ICETOOL Mohan Kothakota DFSORT/ICETOOL 5 Fri Sep 22, 2017 4:56 pm
No new posts OC4 in SORT Mohan Kothakota DFSORT/ICETOOL 2 Tue Sep 12, 2017 6:30 pm
No new posts SORT Trailer Count - LRECL Output co... amorante DFSORT/ICETOOL 5 Tue Aug 29, 2017 8:57 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us