View previous topic :: View next topic
|
Author |
Message |
jegan_selvan
New User
Joined: 23 Oct 2006 Posts: 24 Location: India
|
|
|
|
The input file has a record length of 80 FB (This will contain only detail records). I have another input file which has the date with format CCYYMMDD in the first position with record length 80 and FB.
My requirement is to add a header and trailer record as follows.
HDRCCYYMMDD
Detail record1
Detail record2
Detail record3
TRL00003
where CCYYMMDD ( Date from Reference file)
TRL will contain the count of detail record.
Regards,
Jegan S |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
There is another requirement today that is looking to use a single-record file, Have a look for that to get your date available.
To create a header and a trailer, look at HEADER1 and TRAILER1 on OUTFIL. There are examples in the forum. |
|
Back to top |
|
|
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
jegan_selvan,
real quick without much of a testing, see if below helps...
Code: |
//STEP0001 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
CCYYMMDD
/*
// DD *
DETAIL RECORD1
DETAIL RECORD2
DETAIL RECORD3
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
INREC IFTHEN=(WHEN=GROUP,RECORDS=2,PUSH=(81:1,8))
OPTION COPY
OUTFIL REMOVECC,STARTREC=2,BUILD=(1,80),
HEADER1=('HDR',81,8),
TRAILER1=('TRL',COUNT=(M11,LENGTH=05))
/* |
OUTPUT
Code: |
HDRCCYYMMDD
DETAIL RECORD1
DETAIL RECORD2
DETAIL RECORD3
TRL00003 |
Thanks, |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Or, to add when you've copied the code to generate the symbol/SYMNAMES:
Code: |
//STEP0001 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
DETAIL RECORD1
DETAIL RECORD2
DETAIL RECORD3
/*
//SYMNAMES DD * replace this with your dsn and ditch the single line of data beneath
DATE-FROM-FILE,C'CCYYMMDD'
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
OUTFIL REMOVECC,
HEADER1=('HDR',DATE-FROM-FILE),
TRAILER1=('TRL',COUNT=(M11,LENGTH=05))
|
Output is:
Code: |
HDRCCYYMMDD
DETAIL RECORD1
DETAIL RECORD2
DETAIL RECORD3
TRL00003
|
|
|
Back to top |
|
|
jegan_selvan
New User
Joined: 23 Oct 2006 Posts: 24 Location: India
|
|
|
|
Hi All,
Thanks for your reply and it worked fine.
Regards,
Jegan S |
|
Back to top |
|
|
|