View previous topic :: View next topic
|
Author |
Message |
Dhivya Santosh
New User
Joined: 07 Oct 2008 Posts: 3 Location: Bangalore, India
|
|
|
|
Hi!
I have a requirement wherein I need to append a trailer record to a file in a specific format. The input file will have header and detail records. Assume header format like something having rec type, date created, file type fields. I need to write the trailer which is same as the header, except for an additional field with the count value (which includes the header and trailer while counting).
Can this be achieved through DFSORT/ICETOOL? I do not want to write a new COBOL program just for counting and attaching the trailer. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Had you have searched you would have found this topic posted today.
Click HERE to see anvery similar request. |
|
Back to top |
|
|
Dhivya Santosh
New User
Joined: 07 Oct 2008 Posts: 3 Location: Bangalore, India
|
|
|
|
Hi,
I saw the reply already, but it did not answer one question. Sorry I had not been elaborate in my previous post.
Eg.
<header> 020080303K
<detail1> 1002897189009I20041201
<detail2> 1009922308245I20060923
:
:
<trailer> 920080303K002902 <say>
I can hardcode the rec type and file type, but I need to copy the date (which changes daily) from the header record to the trailer. |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
dhivya santhosh,
You can very easily push the header record on to the trailer using the new WHEN=GROUP function of DFSORT available with z/OS DFSORT V1R5 PTF UK90013 (July, 2008) like this:
I assumed your input is 80 byte lrecl and FB recfm
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
<HEADER> 020080303K
<DETAIL1> 1002897189009I20041201
<DETAIL2> 1009922308245I20060923
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,8,CH,EQ,C'<HEADER>'),
PUSH=(81:11,9))
OUTFIL REMOVECC,BUILD=(1,80),
TRAILER1=('<TRAILER> 9',81,9,COUNT=(M11,LENGTH=6))
/* |
The output from this job is
Code: |
<HEADER> 020080303K
<DETAIL1> 1002897189009I20041201
<DETAIL2> 1009922308245I20060923
<TRAILER> 920080303K000003
|
If you don't have the July, 2008 PTF installed, ask your System Programmer to install it (it's free).
For complete details on the new WHEN=GROUP and the other new functions available with PTF UK90013, see:
Use [URL] BBCode for External Links |
|
Back to top |
|
|
Dhivya Santosh
New User
Joined: 07 Oct 2008 Posts: 3 Location: Bangalore, India
|
|
|
|
Hi,
Thanks for the resolution. Sorry for the delay in getting back.
The above function is very useful and I used it for manipulating header record as well for another application.
Thanks again!! |
|
Back to top |
|
|
|