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
 

 

WRITE FILEOUT from two input file with different key

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: WRITE FILEOUT from two input file with different key
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10257
Location: italy

PostPosted: Fri Sep 25, 2009 8:44 pm    Post subject: Reply to: WRITE FILEOUT FROM TWO INPUT FILE. DIFFERENT KEY.
Reply with quote

take a look at
ftp://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    Post subject:
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    Post subject:
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    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 Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am
No new posts File processing vishwakotin Mainframe Interview Questions 9 Fri Apr 28, 2017 11:38 am


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