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

WRITE FILEOUT from two input file with different key


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

New User


Joined: 14 Sep 2009
Posts: 60
Location: Milan

PostPosted: Fri Sep 25, 2009 7:48 pm
Reply with quote

hello,
i have two input file like this

FILEIN 1
(LREC=290 FB, field1:starting position 1 and length 40 (char)
002501000001
002501000002


FILEIN 2
(LREC=290 FB, field2 :starting position 62 and length 40 (char)
000000002045 XXXXXXXXXXXXXXXX 00000045 002501000001
000000003045 XXXXXXXXXXXXXXXX 00000045 002501000001
000000004045 XXXXXXXXXXXXXXXX 00000045 002501000001
000000005045 XXXXXXXXXXXXXXXX 00000045 002501000001
000000005045 XXXXXXXXXXXXXXXX 00000045 002501000002
000000005045 XXXXXXXXXXXXXXXX 00000045 002501000002
000000005045 XXXXXXXXXXXXXXXX 00000045 002501000003
000000005045 XXXXXXXXXXXXXXXX 00000045 002501000003


FILEOUT
(LREC=290 FB; field 1 must be = field 2)
000000002045 XXXXXXXXXXXXXXXX 00000045 002501000001
000000003045 XXXXXXXXXXXXXXXX 00000045 002501000001
000000004045 XXXXXXXXXXXXXXXX 00000045 002501000001
000000005045 XXXXXXXXXXXXXXXX 00000045 002501000001
000000005045 XXXXXXXXXXXXXXXX 00000045 002501000002
000000005045 XXXXXXXXXXXXXXXX 00000045 002501000002
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Sep 25, 2009 8:44 pm
Reply with quote

take a look at
ftp.software.ibm.com/storage/dfsort/mvs/sorttrck.pdf
page 27 for a thorough analisys of the two files compare problem and relative solutions
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Tue Sep 29, 2009 3:55 am
Reply with quote

theone1987,

The following DFSORT JCL will give you the desired results


Code:

//STEP0100 EXEC PGM=SORT                                               
//SYSOUT   DD SYSOUT=*                                                 
//SORTIN   DD *                                                         
//SORTOUT  DD DSN=&&HDR,DISP=(,PASS),SPACE=(TRK,(1,0),RLSE)             
//SYSIN    DD *                                                         
  SORT FIELDS=COPY                                                     
  OUTFIL REMOVECC,NODETAIL,BUILD=(290X),HEADER1=('HDR')             
/*                                                                     
//STEP0200 EXEC PGM=SORT                                               
//SYSOUT   DD SYSOUT=*                                                 
//SORTIN   DD DSN=&&HDR,DISP=SHR,VOL=REF=*.STEP0100.SORTOUT             
//         DD DSN=your unique key at pos 1 file,disp=shr
//         DD DSN=&&HDR,DISP=SHR,VOL=REF=*.STEP0100.SORTOUT             
//         DD DSN=your duplicate key at pos 62 file,disp=shr
//SORTOUT  DD SYSOUT=*                                                 
//SYSIN    DD *                                                         
  SORT FIELDS=(293,40,CH,A),EQUALS                                     
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,3,CH,EQ,C'HDR'),PUSH=(291:ID=1)), 
  IFTHEN=(WHEN=(291,1,ZD,EQ,1),OVERLAY=(293:01,40)),                   
  IFTHEN=(WHEN=(291,1,ZD,EQ,2),OVERLAY=(293:62,40))                     
  OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(333:SEQNUM,8,ZD,RESTART=(293,40))),
  IFTHEN=(WHEN=GROUP,BEGIN=(333,8,ZD,EQ,1),PUSH=(292:291,1))           
                                                                       
  OUTFIL INCLUDE=(291,2,ZD,EQ,21),BUILD=(1,290)                         
//*
Back to top
View user's profile Send private message
theone1987

New User


Joined: 14 Sep 2009
Posts: 60
Location: Milan

PostPosted: Tue Sep 29, 2009 12:03 pm
Reply with quote

thank you so much!
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 FTP VB File from Mainframe retaining ... JCL & VSAM 1
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top