add header trailer to file with counts on trailer



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

add header trailer to file with counts on trailer

Postby jawaharsmg » Tue Apr 12, 2011 11:34 pm

Hi,

I need to add header and trailer to the input file content and create an output.

Input file
A
B
C
D
E

Output
<Header>
A
B
C
D
E
<trailer>

Header should be in the format
H<LABEL1><todays date>

Trailer should be in the format
T<LABEL1><Rec count><todays date>

Rec count on trailer should include header and trailer records too. So in this case it will be 7.

Is there any way, I can still get a FB file out of this as output rather than a FBA.

Thanks
jawaharsmg
 
Posts: 16
Joined: Tue Feb 16, 2010 8:47 pm
Has thanked: 0 time
Been thanked: 0 time

Re: add header trailer to file with counts on trailer

 

Re: add header trailer to file with counts on trailer

Postby Frank Yaeger » Wed Apr 13, 2011 1:03 am

You can use a DFSORT job like the following. You didn't show what you want the date or count to look like, so all I could do was guess.

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=...  input file
//SORTOUT DD DSN=...  output file
//SYSIN DD *
  OPTION COPY
  OUTFIL REMOVECC,
    HEADER1=('H<LABEL1>',DATE=(4MD/)),
    TRAILER1=('T<LABEL1>',COUNT+2=(M11,LENGTH=8),X,DATE=(4MD/))
/*


If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

http://www.ibm.com/support/docview.wss? ... g3T7000080
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1080
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 14 times

Re: add header trailer to file with counts on trailer

Postby jawaharsmg » Thu Apr 14, 2011 3:35 am

Thanks Frank.

I forgot to mention that the date is not to be from the system but to read from an other file. Can you help.

Meanwhile, I will go thru the doc link attached.

thanks again
jawaharsmg
 
Posts: 16
Joined: Tue Feb 16, 2010 8:47 pm
Has thanked: 0 time
Been thanked: 0 time

Re: add header trailer to file with counts on trailer

Postby Frank Yaeger » Thu Apr 14, 2011 8:17 pm

I forgot to mention that the date is not to be from the system but to read from an other file


You need to show an example of the record or records in that other file so I can see where the date is and what it looks like. Also, give the RECFM and LRECL of that other file and the starting position and length of the date.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1080
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 14 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post