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

Adding a value from header record to all data records


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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
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
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
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:

Use [URL] BBCode for External Links
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 0
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Store the data for fixed length COBOL Programming 1
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
Search our Forums:

Back to Top