Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Adding a value from header record to all data records

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
vishweshkrishnadevaram

New User


Joined: 17 Nov 2006
Posts: 7

PostPosted: Tue Mar 03, 2009 4:16 pm    Post subject: Adding a value from header record to all data records
Reply with quote

Hi,

I've a requirement where I need to extract a date from header record of input file and this date should be written to all the data records in output file. Also, I need to use SUM FIELDS to sum data of few fields. Can anyone suggest me, whether we can do this using SORT?
Back to top
View user's profile Send private message

Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue Mar 03, 2009 9:50 pm    Post subject:
Reply with quote

vishweshkrishnadevaram,

Show us a sample Data with DCB attributes of the files along with the position of the date field to be moved , the sorting fields and summing fields and their formats
Back to top
View user's profile Send private message
vishweshkrishnadevaram

New User


Joined: 17 Nov 2006
Posts: 7

PostPosted: Wed Mar 04, 2009 4:16 pm    Post subject: Reply to: Adding a value from header record to all data reco
Reply with quote

Hi Kolusu,

Actually the requirement is changed now and the date need not be moved to the data record. Thanks for the response. But just curious to know, if it's possible to retrieve a field from a record and use it in all the next records.

Vishwesh
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed Mar 04, 2009 10:46 pm    Post subject: Re: Reply to: Adding a value from header record to all data
Reply with quote

vishweshkrishnadevaram wrote:
Hi Kolusu,

Actually the requirement is changed now and the date need not be moved to the data record. Thanks for the response. But just curious to know, if it's possible to retrieve a field from a record and use it in all the next records.

Vishwesh


You can very easily push the header record on to the detail records 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> 20080303                                         
<DETAIL1>                                                 
<DETAIL2>                                                 
//SORTOUT  DD SYSOUT=*                                   
//SYSIN    DD *                                           
  SORT FIELDS=COPY                                       
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,8,CH,EQ,C'<HEADER>'),
  PUSH=(31:10,8)),                                       
  IFTHEN=(WHEN=(1,8,CH,EQ,C'<HEADER>'),OVERLAY=(31:8X))   
/*


The output from this job is
Code:

<HEADER> 20080303                           
<DETAIL1>                     20080303       
<DETAIL2>                     20080303       


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:

www.ibm.com/systems/support/storage/software/sort/mvs/ugpf/
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 Moving a COMP-3 Variable to a Numeric... ajayachander COBOL Programming 2 Thu Dec 14, 2017 5:46 pm
No new posts Inefficient BUILD - VB records paddin... Daniel Prosser SYNCSORT 6 Thu Dec 14, 2017 3:52 pm
No new posts ISSUE IN copying Sequential file reco... thesumitk JCL & VSAM 2 Wed Dec 13, 2017 3:07 pm
No new posts query to fetch record which has only ... maxsubrat DB2 12 Mon Dec 11, 2017 5:03 pm
No new posts Merging 2 records at multiple rows wi... Bijesh DFSORT/ICETOOL 2 Wed Dec 06, 2017 1:50 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us