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

comparing two files on multiple keys but write multiple recs


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
skgupta81

New User


Joined: 11 Nov 2008
Posts: 27
Location: Canada

PostPosted: Wed Aug 28, 2013 3:06 am
Reply with quote

Need your help to perform below task using DFSORT.
Out system is recently upgraded and should support most of the DFSORT functions.

Input file 1 ( length 900)
1-854 (general data)
855-857 (Key 1)
filler
859-861 (Key 2)
filler
863-865 (Key 3)
--- upto (key 25)

for example below it shows data from position 855-900

Code:
line1(1-854)005 002 001 004 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000  upto 25 values
line2(1-854)005 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000  upto 25 values
line3(1-854)070 002 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000  upto 25 values



Input file 2 (lenght 130)
1-3 (key)
4-5 filler
6-12 (text)
13-130 filler

data :
Code:
001  text001
002  text002
003  text003
004  text004
005  text005
006  text006
007  text007
008  text008
009  text009
010  text010
up to
999  test999


Output file should be

Code:
line1(1-854)text005
line1(1-854)text002
line1(1-854)text001
line1(1-854)text004
line2(1-854)text005
line3(1-854)text070
line3(1-854)text002


This is like, picking up first record from file 1, compare the keys with file 2 and write as many number of records in output file as the matching keys
For expample here, first record has 4 matching keys, so four records with appended text from file 2(6-12)

I hope, I was clear in providing requirements. Thanks for your help
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Wed Aug 28, 2013 1:06 pm
Reply with quote

Hi,

this should get you started

Code:
//STEP0100 EXEC PGM=SORT                                             
//SYSOUT   DD SYSOUT=*                                                 
//SORTIN   DD *                                                       
LINE1(1-854)005 002 001 004 000 000 000 000 000 000 000 000 000 000 000
LINE2(1-854)005 000 000 000 000 000 000 000 000 000 000 000 000 000 000
LINE3(1-854)070 002 000 000 000 000 000 000 000 000 000 000 000 000 000
//SORTOUT  DD DSN=&&T1,DISP=(,PASS,DELETE),UNIT=SYSDA,                 
//            SPACE=(TRK,(10,5),RLSE)                                 
//SYSIN    DD *                                                       
  SORT FIELDS=COPY                                                     
  OUTFIL BUILD=(1,15,/,                                               
                1,12,17,3,/,                                           
                1,12,21,3,/,                                           
                1,12,25,3,/,                                           
                1,12,29,3,/,                                           
                1,12,33,3,/,                                           
                1,12,37,3,/,                                           
                1,12,41,3,/,                                           
                1,12,45,3,/,                                           
                1,12,49,3,/,                     
                1,12,53,3,/,                     
                1,12,57,3,/,                     
                1,12,61,3,/,                     
                1,12,65,3,/,                     
                1,12,69,3)                       
/*                                               
//STEP0200 EXEC PGM=SORT                         
//SYSOUT   DD SYSOUT=*                           
//INA      DD DSN=&&T1,DISP=SHR                   
//INB      DD *                                   
001  TEXT001                                     
002  TEXT002                                     
003  TEXT003                                     
004  TEXT004                                     
005  TEXT005                                     
006  TEXT006                                     
007  TEXT007                                     
008  TEXT008                                     
009  TEXT009                                     
010  TEXT010                                     
070  TEXT070                                     
//SORTOUT  DD SYSOUT=*                                     
//SYSIN    DD *                                             
  SORT FIELDS=(16,4,BI,A)                                   
  JOINKEYS F1=INA,FIELDS=(13,3,A)                           
  JOINKEYS F2=INB,FIELDS=(1,3,A)                           
  REFORMAT FIELDS=(F1:1,19,?,F2:1,12)                       
  OUTREC BUILD=(1,12,26,7)                                 
//*                                                         
//JNF1CNTL DD *                                             
  INREC OVERLAY=(16:SEQNUM,4,ZD)                           
//*                                                         



Gerry
Back to top
View user's profile Send private message
skgupta81

New User


Joined: 11 Nov 2008
Posts: 27
Location: Canada

PostPosted: Wed Aug 28, 2013 9:07 pm
Reply with quote

Thanks gcicchet.

After doing little modification with field positions, the code worked.

Have a good one.
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 0
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
Search our Forums:

Back to Top