Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups 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 Innovations in Your Mainframe Sort Arun Raj PC Guides & IT News 4 Wed Mar 15, 2017 10:38 pm
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm
No new posts SORT requirement sjiraga COBOL Programming 6 Thu Mar 09, 2017 9:11 pm
No new posts Join giving more records than expected Danielle.Filteau SYNCSORT 2 Thu Mar 09, 2017 3:28 am
No new posts SORT to append Month and YEAR in MMYY... tisamf DFSORT/ICETOOL 1 Wed Mar 08, 2017 4:46 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us