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

merge files after altering the records


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ashimer

Active Member


Joined: 13 Feb 2004
Posts: 551
Location: Bangalore

PostPosted: Thu Mar 20, 2008 3:17 pm
Reply with quote

hi,

i have 2 files one with header and trailer and the other with detailed records..

now i need to merge these 2 files into one so that the detailed records comes
in between the header and trailer.

ie file 1 is 35 bytes with header and trailer

ASHIMER 15:2306/08/200706/08/2007
TRLR000005

and file 2 has the detailed records with record count of 5

now the new output file should have the header as he first record with the format changed as

HASHIMER****06/08/2007 (* is spaces) where date is the first date mentioned in the above original header
then followed by detailed records and
then trailer as

T000005

the LRECL for first file is 35 and 2nd file is 150 ..


kindly help
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Thu Mar 20, 2008 4:00 pm
Reply with quote

Use IDCAMS REPRO -
Back to top
View user's profile Send private message
ashimer

Active Member


Joined: 13 Feb 2004
Posts: 551
Location: Bangalore

PostPosted: Thu Mar 20, 2008 4:07 pm
Reply with quote

expat,

can you pls provide the code ?

thanks,
ashimer
Back to top
View user's profile Send private message
ParagChouguley

Active User


Joined: 03 Feb 2007
Posts: 175
Location: PUNE(INDIA)

PostPosted: Thu Mar 20, 2008 4:40 pm
Reply with quote

Here is an Syncsort Job.
Code:

//S1      EXEC PGM=SYNCTOOL         
//TOOLMSG DD SYSOUT=*               
//DFSMSG  DD SYSOUT=*               
//IN1     DD *                     
ASHIMER 15:2306/08/200706/08/2007   
TRLR000005                         
/*                                 
//*                                 
//IN2     DD *                     
RECORD NO 1                         
RECORD NO 2                         
RECORD NO 3                         
RECORD NO 4                         
/*
//OUT1    DD DSN=OUTPUT-FILE-NAME,                 
//      DSORG=PS,RECFM=FB,SPACE=(TRK,(1,1),RLSE), 
//      DISP=(MOD,CATLG,DELETE)                   
//TOOLIN  DD *                                     
    COPY FROM(IN1) TO(OUT1) USING(SRT1)           
    COPY FROM(IN2) TO(OUT1)                       
    COPY FROM(IN1) TO(OUT1) USING(SRT2)           
/*
//SRT1CNTL DD *                                               
    OPTION COPY                                               
    OUTFIL STARTREC=1,ENDREC=1,OUTREC=(C'H',1,7,4X,14,10,128X)
/*                                                             
//SRT2CNTL DD *                                               
    OPTION COPY                                               
    OUTFIL STARTREC=2,OUTREC=(1,1,5,6,143X)                   
/*                                                             


Output:
Code:

HASHIMER    06/08/2007
RECORD NO 1           
RECORD NO 2           
RECORD NO 3           
RECORD NO 4           
RECORD NO 5           
T000005               


--Parag
Back to top
View user's profile Send private message
ashimer

Active Member


Joined: 13 Feb 2004
Posts: 551
Location: Bangalore

PostPosted: Thu Mar 20, 2008 6:07 pm
Reply with quote

thanks for the reply parag


but it is giving problem with LRECL ...
my IN1 is 35 and IN2 is 361 and output file shud be 361 ...

pls help
Back to top
View user's profile Send private message
ParagChouguley

Active User


Joined: 03 Feb 2007
Posts: 175
Location: PUNE(INDIA)

PostPosted: Thu Mar 20, 2008 7:26 pm
Reply with quote

Change the sort cards to
Code:

//SRT1CNTL DD *                                               
    OPTION COPY                                               
    OUTFIL STARTREC=1,ENDREC=1,OUTREC=(C'H',1,7,4X,14,10,339X)
/*                                                           
//SRT2CNTL DD *                                               
    OPTION COPY                                               
    OUTFIL STARTREC=2,OUTREC=(1,1,5,6,354X)                   
/*                                                           


--Parag
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
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
No new posts Pulling a fixed number of records fro... DB2 2
Search our Forums:

Back to Top