Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Merge multiple files with header & trailer into 1 file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
aneeta

New User


Joined: 08 Dec 2005
Posts: 48
Location: Chennai

PostPosted: Tue Apr 17, 2007 11:38 pm    Post subject: Merge multiple files with header & trailer into 1 file
Reply with quote

Hi,
I have multiple files of same length and RECFM with each file having a header and a trailer.I need to merge all the files into 1 file with a single header and trailer.
Note:The header should contain the latest time stamp and the trailer should contain the total no. of records in all the files.The header can be identified by a starting 'H' and a trailer by a starting 'T'.

Eg:
RECFM=FB,LRECL=80
File1:
H2007-01-03-01.01.0000002007-01-03-01.01.000000
A
B
C
T0000003

File2:
H2007-01-02-01.01.0000002007-01-02-01.01.000000
AA
BB
CC
DD
EE
T0000005

File3:
H2007-01-01-01.01.0000002007-01-01-01.01.000000
AAA
BBB
CCCC
DDDD
EEE
FGHJ
UYU
T0000007

Output File:
H2007-01-03-01.01.0000002007-01-03-01.01.000000
A
B
C
AA
BB
CC
DD
EE
AAA
BBB
CCCC
DDDD
EEE
FGHJ
UYU
T0000015

Pls provide a solution thru DFSORT.Pls let me know if more explanation is required.

Thanks
Aneeta
Back to top
View user's profile Send private message

Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Wed Apr 18, 2007 12:26 am    Post subject:
Reply with quote

It appears that the trailer record is just T and the count, so it can easily be recreated with TRAILER1.

Can the header record be recreated as well with H and the current date and time in some form (what form?), or does the most current header record need to be kept as is?
Back to top
View user's profile Send private message
aneeta

New User


Joined: 08 Dec 2005
Posts: 48
Location: Chennai

PostPosted: Wed Apr 18, 2007 11:02 pm    Post subject: Re: Merge multiple files with header & trailer into 1 fi
Reply with quote

Hi Frank,
Pls make the solution generic as we have to merge different types.But the similarity between all the types of files is the Header will start with a 'H' followed by the date (may be once or twice) and the trailer with a 'T' followed by the count.

The most recent header to be populated in the output file wud be the best choice.
Pls let me know if more information is reqd.

Thanks
Aneeta
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Wed Apr 18, 2007 11:51 pm    Post subject:
Reply with quote

Aneeta,

Here's a DFSORT/ICETOOL job that will do what you asked for. It keeps the most recent record as is and rebuilds the trailer record with 'T' and the new count.

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//CON DD DSN=...  input file1
//    DD DSN=...  input file2
//    DD DSN=...  input file3
//***> OUT MUST BE A MOD DATA SET
//OUT DD DISP=MOD,DSN=...
//TOOLIN   DD    *
SORT FROM(CON) USING(CTL1)
COPY FROM(CON) USING(CTL2)
/*
//CTL1CNTL DD *
  INCLUDE COND=(1,1,CH,EQ,C'H')
  SORT FIELDS=(2,10,UFF,D)
  OUTFIL FNAMES=OUT,ENDREC=1
/*
//CTL2CNTL DD *
  OMIT COND=(1,1,SS,EQ,C'H,T')
  OUTFIL FNAMES=OUT,REMOVECC,
    TRAILER1=(C'T',COUNT=(M11,LENGTH=7))
/*
Back to top
View user's profile Send private message
aneeta

New User


Joined: 08 Dec 2005
Posts: 48
Location: Chennai

PostPosted: Thu Apr 19, 2007 10:16 pm    Post subject: Re: Merge multiple files with header & trailer into 1 fi
Reply with quote

Thanks Frank..
Can u explain this statement SORT FIELDS=(2,10,UFF,D)?
What REMOVECC does?

Thanks
Aneeta
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Thu Apr 19, 2007 10:33 pm    Post subject:
Reply with quote

UFF is unsigned free format. I'm using it to treat yyyy-mm-dd as yyyymmdd. You can find details at:

www.ibm.com/servers/storage/support/software/sort/mvs/pdug/

REMOVECC removes the ANSI carriage control character (e.g. '1' for eject), so the 'T' starts in position 1. Without REMOVECC, the 'T' would start in position 2.
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 ejck thru rexx to multiple jobs insid... Susanta All Other Mainframe Topics 5 Tue Sep 19, 2017 1:39 pm
No new posts Split 1 file into 10 output Files - S... Prasanth Kumar SYNCSORT 5 Sat Sep 16, 2017 12:02 am
No new posts BUILD OUTFIL based on condition other... balaji81_k DFSORT/ICETOOL 13 Fri Sep 08, 2017 11:06 pm
No new posts PLI - printing from multiple programs Pedro PL/I & Assembler 8 Fri Sep 08, 2017 6:36 am
No new posts Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us