IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to add filed from detail record to header record


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ramyashree20

New User


Joined: 12 Mar 2008
Posts: 2
Location: india

PostPosted: Thu Mar 20, 2008 12:26 pm
Reply with quote

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
View user's profile Send private message
ramyashree20

New User


Joined: 12 Mar 2008
Posts: 2
Location: india

PostPosted: Thu Mar 20, 2008 3:08 pm
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Mar 20, 2008 8:04 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Validating record count of a file is ... DFSORT/ICETOOL 13
Search our Forums:

Back to Top