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 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 Create procedure issues -628 when add... chandraBE DB2 1 Mon Sep 18, 2017 12:16 pm
No new posts Question related to Data dictionary f... rexx77 SYNCSORT 3 Thu Aug 31, 2017 7:23 am
No new posts Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm
No new posts Repeat part of record multiple times Learncoholic DFSORT/ICETOOL 4 Tue Aug 29, 2017 11:33 am
No new posts Join records from 2 files with No Dup... Poha Eater DFSORT/ICETOOL 21 Sun Aug 27, 2017 10:35 pm

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