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

2 INPUT FILE == > 1 OUTPUT FILE


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: Thu Mar 25, 2010 3:26 pm
Reply with quote

hi everyone,
I have two input files and I have to build an output file.
1 contains the input file duplicates.
2 input file has no duplicates.
have in common the key from position 1 to 17.
the output file should contain all the records of the input file input file 1 + 2


FILEINPUT 1 (FB length 100)
05228000081302001 PD310
05228000081302001 PC310
05228000081302001 ZX310
05228000012854555 PD310
05228000012854555 AD310

FILEINPUT 2 (FB length 150)
05228000081302001 PD310 XXXXXXXXXXXXXXXXXXXXXXXXXXX
05228000012854555 PD310 YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY


FILE OUTPUT (FB length 150)
(contain from position 1 to 30 of fileinput 1 + from posizion 31 to 150 of fileinput 2)
05228000081302001 PD310 XXXXXXXXXXXXXXXXXXXXXXXXXXX
05228000081302001 PC310 XXXXXXXXXXXXXXXXXXXXXXXXXXX
05228000081302001 ZX310 XXXXXXXXXXXXXXXXXXXXXXXXXXX
05228000012854555 PD310 YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
05228000012854555 AD310 YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY


i hope it's all clear.
Back to top
View user's profile Send private message
Rambhupal.chaudari

New User


Joined: 30 Mar 2007
Posts: 25
Location: Hyderabad

PostPosted: Thu Mar 25, 2010 5:29 pm
Reply with quote

Hi dude,

Try this.

Code:
//STEP0001 EXEC PGM=ICETOOL                               
//INDD1    DD   *                                         
05228000081302001 PD310                                   
05228000081302001 PC310                                   
05228000081302001 ZX310                                   
05228000012854555 PD310                                   
05228000012854555 AD310                                   
/*                                                         
//INDD2    DD   *                                         
05228000081302001 PD310 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX   
05228000012854555 PD310 YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY   
/*                                                         
//T1       DD  DISP=(MOD,PASS),UNIT=VIO,SPACE=(TRK,(1,1)) 
//OUT      DD  DSN=temp,               
//             DISP=(OLD,CATLG,DELETE),                   
//             SPACE=(CYL,(5,5),RLSE)                     
//DFSMSG   DD  SYSOUT=*                                         
//TOOLMSG  DD  SYSOUT=*                                         
//TOOLIN   DD  *                                               
COPY FROM(INDD2) TO(T1) USING(CTL1)                             
COPY FROM(INDD1) TO(T1) USING(CTL2)                             
SPLICE FROM(T1) WITHALL   USING(CTL3)-                         
   ON(1,17,ZD) -                                               
   WITH(19,05) -                                               
   TO(OUT)                                                     
/*                                                             
//CTL1CNTL DD *                                                 
  OUTREC FIELDS=(1:1,17,25:25,31)                               
/*                                                             
//CTL2CNTL DD *                                                 
  OUTREC FIELDS=(1:1,17,19:19,05)                               
/*                                                             
//CTL3CNTL DD *                                                 
   SORT  FIELDS=(1,17,ZD,D)             
/*
Back to top
View user's profile Send private message
theone1987

New User


Joined: 14 Sep 2009
Posts: 60
Location: Milan

PostPosted: Thu Mar 25, 2010 7:56 pm
Reply with quote

thank you!
it works!
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Thu Mar 25, 2010 9:29 pm
Reply with quote

theone1987,

Isn't this request quite similar to the similar requests you asked before

ibmmainframes.com/viewtopic.php?t=47545

ibmmainframes.com/viewtopic.php?t=47457

Try to understand the solutions and modify your new requirements accordingly. Despite me explaining via PM you still have the same matching files questions all over again.

Here is the DFSORT JCL which will give you the desired results

Code:

//STEP0100 EXEC PGM=SORT                                               
//SYSOUT   DD SYSOUT=*                                                 
//SORTIN   DD DSN=your input FB 100 file,DISP=SHR
//SORTOUT  DD DSN=&&TM150,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)           
//HEADR    DD DSN=&&HEADR,DISP=(,PASS),SPACE=(TRK,(1,0),RLSE)           
//SYSIN    DD *                                                         
  SORT FIELDS=COPY                                                     
  INREC BUILD=(1,30,150:X)                                             
  OUTFIL FNAMES=HEADR,ENDREC=1,BUILD=(3C'$',150:X)                     
//*                                                                     
//STEP0200 EXEC PGM=SORT                                               
//SYSOUT   DD SYSOUT=*                                                 
//SORTIN   DD DSN=&&HEADR,DISP=SHR,VOL=REF=*.STEP0100.HEADR             
//         DD DSN=your input FB 150 file,DISP=SHR
//         DD DSN=&&HEADR,DISP=SHR,VOL=REF=*.STEP0100.HEADR             
//         DD DSN=&&TM150,DISP=SHR                                     
//SORTOUT  DD SYSOUT=*                                                 
//SYSIN    DD *                                                         
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,3,CH,EQ,C'$$$'),PUSH=(151:ID=1))   
  SORT FIELDS=(1,17,CH,D),EQUALS                                       
  OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(153:SEQNUM,8,ZD,RESTART=(1,17))),   
  IFTHEN=(WHEN=GROUP,BEGIN=(153,8,ZD,EQ,1),PUSH=(31:31,120,152:151,1)) 
  OUTFIL BUILD=(1,150),INCLUDE=(151,2,ZD,EQ,21,AND,1,3,CH,NE,C'$$$')   
//*
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 TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
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
Search our Forums:

Back to Top