header and trailer records

In this Mainframe Forum - You can post your queries on DFSORT, ICETOOL , SyncSort & JCL Utilities

Moderators: Frank Yaeger, Moderator Group

Post Reply
juares castro
Member
Posts: 11
Joined: Fri Nov 11, 2011 7:21 pm

header and trailer records

Post by juares castro » Thu Dec 15, 2011 2:17 am

Hi All!
Could DFSORT generate a HEADER record and a TRAILER record when reading a sequence file?
I mean, I have a sequence file like:

FB, 100 bytes for example:

AAA 1234567890
AAA 0987654321
BBB XXXXXXXXXX
AAA YYYYYYYYYY
XXX 1234567890
123 AAAAAAAAAA

So, it doesn't matter what information we have.

The output shoud have:

20111214 EXAMPLE FILE 01 <= header record with current date
AAA 1234567890
AAA 0987654321
BBB XXXXXXXXXX
AAA YYYYYYYYYY
XXX 1234567890
123 AAAAAAAAAA <= all previous records copied
20111214 EXAMPLE FILE 01 000006 <= trailer with current date and total of significant previous records.

Thanks in advance!
juares castro

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Thu Dec 15, 2011 2:53 am

Here's a DFSORT job that will do what you asked for:

Code: Select all

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=...  input file &#40;FB/100&#41;
//SORTOUT DD DSN=...  output file &#40;FB/100&#41;
//SYSIN DD *
  OPTION COPY
  OUTFIL REMOVECC,
    HEADER1=&#40;DATENS=&#40;4MD&#41;,' EXAMPLE FILE 01'&#41;,
    TRAILER1=&#40;DATENS=&#40;4MD&#41;,' EXAMPLE FILE 01 ',
       COUNT=&#40;M11,LENGTH=6&#41;&#41;
/*
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

juares castro
Member
Posts: 11
Joined: Fri Nov 11, 2011 7:21 pm

Post by juares castro » Thu Dec 15, 2011 7:26 pm

Thanks a lot Frank!
juares castro

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others