MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Merge header from one file to another

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
ssanthosh
Beginner


Joined: 19 Mar 2007
Posts: 13
Topics: 5

PostPosted: Fri Jun 13, 2008 9:27 am    Post subject: Merge header from one file to another Reply with quote

I have 2 FBA files (LRECL=134) one with header and one without header. I have a requiremnt to copy ONLY the header from one file to another at the begining of each page.
File1: (with header): Each page begins with following header (same header for all pages)
REPORT : XXXXX-XXX DEPT:XX
.
.

File2: (no header): Each page (1st record) has the following format
PAGE: 0001 - XXXXX XXXXXX
.
.

The resultant file shoud be,
File2:
REPORT : XXXXX-XXX DEPT:XX
PAGE: 0001 - XXXXX XXXXXX
.
.
.

I tried FILEMGR but did not get the expected result. Could you advise me.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Fri Jun 13, 2008 11:41 am    Post subject: Reply with quote

ssanthosh,

The following DFSORT JCL will give you desired results

Code:

//STEP0100 EXEC PGM=ICEMAN                                 
//SYSOUT   DD SYSOUT=*                                     
//SORTIN   DD DSN=your file 1 with header,DISP=SHR
//SORTOUT  DD DSN=&&T1,DISP=(,PASS),SPACE=(TRK,(1,1),RLSE) 
//SYSIN    DD *                                             
  SORT FIELDS=COPY                                         
  OPTION STOPAFT=1                                         
  OUTREC BUILD=(C'HDR1,C',C'''',3,25,C'''',80:X)           
/*                                                         
//STEP0200 EXEC PGM=ICEMAN                                 
//SYSOUT   DD SYSOUT=*                                     
//SYMNAMES DD DSN=&&T1,DISP=SHR                             
//SORTIN   DD DSN=your file 2 without headers,DISP=SHR
//SORTOUT  DD SYSOUT=*                                     
//SYSIN    DD *                                             
  SORT FIELDS=COPY                                         
  OUTFIL IFOUTLEN=134,                                     
     IFTHEN=(WHEN=(2,5,CH,EQ,C'PAGE:'),                     
     BUILD=(2:HDR1,134:X,/,1,134))                         
/*

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ssanthosh
Beginner


Joined: 19 Mar 2007
Posts: 13
Topics: 5

PostPosted: Mon Jun 16, 2008 11:11 am    Post subject: Reply with quote

Thank you. The above JCL works perfect. But i need all the 134 bytes of the header (STEP0100) in the temp file. At present STEP0100 SORTOUT dataset has LRECl=80. I changed the SYSIN to 134:X instead 80:X then the STEP0200 failed. Just lost! Please guide me.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Mon Jun 16, 2008 11:25 am    Post subject: Reply with quote

ssanthosh,

You got an error because the SYMNAMES DD is supposed to be 80 bytes and FB recfm. if you need the 134 bytes header we need to split it into small chunks. Change your step0100 control cards for the following

Code:

//SYSIN    DD *                                     
  SORT FIELDS=COPY                                 
  OPTION STOPAFT=1                                 
  OUTFIL BUILD=(C'HDR1,C',C'''',001,50,C'''',/,     
                C'HDR2,C',C'''',051,50,C'''',/,     
                C'HDR3,C',C'''',101,34,C'''',80:X) 
                                                   
/*


and step0200 to the following

Code:

//SYSIN    DD *                                 
  SORT FIELDS=COPY                             
  OUTFIL IFOUTLEN=134,                         
     IFTHEN=(WHEN=(2,5,CH,EQ,C'PAGE:'),         
     BUILD=(1:HDR1,HDR2,HDR3,/,1,134))         
/*



Hope this helps...
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group