View previous topic :: View next topic
|
Author |
Message |
ramyashree20
New User
Joined: 12 Mar 2008 Posts: 2 Location: india
|
|
|
|
Hi ,
I have a file and i am adding a header and trailer record to it.
I got one more request . There is date filed in the detail record and i have to put the date filed value of detail record in header .
Below is a example
HABCD1234
cjdifslkfj 12345 20080213 mcvrif 1234
cjdifslkfj 12345 20080213 mcvrif 1234
cjdifslkfj 12345 20080213 mcvrif 1234
cjdifslkfj 12345 20080213 mcvrif 1234
TABCD 1234
I need to add the date field from detail record to header record.
Thanks, |
|
Back to top |
|
|
ramyashree20
New User
Joined: 12 Mar 2008 Posts: 2 Location: india
|
|
|
|
Hi ,
The date which we are putting in the header will not be same always....
here is the details...
I have a file with data like this:
cjdifslkfj 12345 CCYYMMDD mcvrif 1234
cjdifslkfj 12345 CCYYMMDD mcvrif 1234
cjdifslkfj 12345 CCYYMMDD mcvrif 1234
cjdifslkfj 12345 CCYYMMDD mcvrif 1234
to this file i am adding the header and trailer using sort.
Now to that header i have to add a date field from the detail record i .e.., CCYYMMDD this date will be from detail record. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
You can use a DFSORT job like the following to do what you asked for:
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file (FB)
//SORTOUT DD DSN=... output file (FB)
//SYSIN DD *
OPTION COPY
OUTFIL HEADER1=('HABCD1234',X,18,8),
TRAILER1=('TABCD 1234')
/*
|
The S2 SORTOUT will have:
Code: |
HABCD1234 20080213
cjdifslkfj 12345 20080213 mcvrif 1234
cjdifslkfj 12345 20080213 mcvrif 1234
cjdifslkfj 12345 20080213 mcvrif 1234
cjdifslkfj 12345 20080213 mcvrif 1234
TABCD 1234
|
|
|
Back to top |
|
|
|