Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to add filed from detail record to header record

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: How to add filed from detail record to header record
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    Post subject: Reply to: How to add filed from detail record to header reco
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 Moderator


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

PostPosted: Thu Mar 20, 2008 8:04 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts How can we have the varying lenth of ... Gunapala CN DFSORT/ICETOOL 6 Fri Oct 14, 2016 7:31 pm
No new posts sort with previous record anatol DFSORT/ICETOOL 9 Thu Oct 06, 2016 2:36 am
No new posts Get Record count in summary record fo... Atul Banke DFSORT/ICETOOL 21 Fri Sep 23, 2016 4:17 pm
No new posts Change date (DD/MM/YY) in 2nd record ... uday kiran DFSORT/ICETOOL 12 Wed Sep 07, 2016 10:57 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us