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
 

 

Populate one field value of detail record on header record

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

New User


Joined: 27 Feb 2008
Posts: 78
Location: india

PostPosted: Wed Jul 28, 2010 10:45 am    Post subject: Populate one field value of detail record on header record
Reply with quote

I have a input file and lot of columns and records are there. The records are consist of header and details. Sometimes the header has 2 detail line or 3 detail line. There are thousands of records like this.

I want to copy one value of a field from detail record to header record.

For exp:

H|ACD1384738 |2009-10-01|023
D|ACD1384738 |2009-10-01|023395620
D|ACD1384738 |2009-10-01|023395620
H|ACD1384743 |2009-10-01|023
D|ACD1384743 |2009-10-01|023395624
D|ACD1384743 |2009-10-01|023395624
H|ACD1384756 |2009-10-01|023
D|ACD1384756 |2009-10-01|023395628

here the 4th column field has values in detail line but not in header line.
This fourth field has the PIC 9(09). The 1st 3 characters are populated already. I want the rest 6 fields to populate. i.e. The value in detail record should populate in their header record also. To get more clear, the output data should be like this:

H|ACD1384738 |2009-10-01|023395620
D|ACD1384738 |2009-10-01|023395620
D|ACD1384738 |2009-10-01|023395620
H|ACD1384743 |2009-10-01|023395624
D|ACD1384743 |2009-10-01|023395624
D|ACD1384743 |2009-10-01|023395624
H|ACD1384756 |2009-10-01|023395628
D|ACD1384756 |2009-10-01|023395628

starting position of that field is 28 and length is 9. Please someone can answer if this can be fixed thru any sort. Thanks in advance.
Back to top
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Jul 28, 2010 7:12 pm    Post subject:
Reply with quote

Hello,

What should happen when the 4th field in the detail records has more than one value for the "key" (which is the 2nd field?)?
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Wed Jul 28, 2010 9:53 pm    Post subject:
Reply with quote

maxsubrat,

Since you haven't provided the LRECL and REFCM of the input and output files, here is a DFSORT JOB which would give you the desired results based on the assumptions

1. Your Input is FB recfm and has an LRECL of 80
2. The header value gets the first detail record value from pos 26 for a length of 9 bytes

Code:

//STEP0100 EXEC PGM=SORT                                           
//SYSOUT   DD SYSOUT=*                                             
//SORTIN   DD *                                                   
H|ACD1384738 |2009-10-01|023     
D|ACD1384738 |2009-10-01|023395620                                 
D|ACD1384738 |2009-10-01|023395620                                 
H|ACD1384743 |2009-10-01|023     
D|ACD1384743 |2009-10-01|023395624                                 
D|ACD1384743 |2009-10-01|023395624                                 
H|ACD1384756 |2009-10-01|023     
D|ACD1384756 |2009-10-01|023395628                                 
//SORTOUT  DD SYSOUT=*                                             
//SYSIN    DD *                                                   
  SORT FIELDS=COPY                                                 
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,1,CH,EQ,C'H'),                 
  PUSH=(81:1,80),RECORDS=2)                                       
  OUTFIL IFOUTLEN=80,OMIT=(1,1,CH,EQ,C'H'),                       
  IFTHEN=(WHEN=(81,1,CH,EQ,C'H'),BUILD=(81,25,26,9,115,46,/,1,80))
//*
Back to top
View user's profile Send private message
smijoss

Active User


Joined: 30 Aug 2007
Posts: 114
Location: pune

PostPosted: Wed Jul 28, 2010 10:22 pm    Post subject:
Reply with quote

Skolusu you are great
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 Need to write record of PS File in ex... Chandan1993 JCL & VSAM 1 Wed Jun 07, 2017 1:35 am
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
No new posts READ A PACKED "NEGATIVE" FI... jdesouza CA Products 3 Tue May 02, 2017 11:43 pm


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