IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Join in SORT


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
No new posts how to calculate SUM value for VB fil... DFSORT/ICETOOL 1
Search our Forums:

Back to Top