Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Copy record key on other records

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

New User


Joined: 31 Mar 2015
Posts: 18
Location: Italy

PostPosted: Thu Apr 02, 2015 10:16 pm    Post subject: Copy record key on other records
Reply with quote

Hi,

I've a dataset with 2 record types (record type "1" and "2"). Record type is located on first column and record type 2 all refer to the previsous record type 1, like to it follows:
Code:
1 key001 field1
2        data-a
2        data-b
2        data-c
2        data-d
1 key002 field1
2        data-a
2        data-b
1 key003 field1
2        data-a
2        data-b
2        data-c
2        data-d


And the desired output is:
Code:
1 key001 field1
2 key001 data-a
2 key001 data-b
2 key001 data-c
2 key001 data-d
1 key002 field1
2 key002 data-a
2 key002 data-b
1 key003 field1
2 key003 data-a
2 key003 data-b
2 key003 data-c
2 key003 data-d


Do you know if and how it can be done with DFSORT or ICETOOL?
I hope the question is not too easy for the expert forum.

Thanks a lot, regards.
Back to top
View user's profile Send private message

RahulG31

Active User


Joined: 20 Dec 2014
Posts: 447
Location: USA

PostPosted: Thu Apr 02, 2015 10:42 pm    Post subject: Reply to: Copy record key on other records
Reply with quote

Use the below card in SORT and don't forget to read the SORT manual for future :-)
Code:
//SYSIN DD *                                         
 OPTION COPY                                         
 OUTREC IFTHEN=(WHEN=GROUP,BEGIN=(3,1,CH,NE,C' '),   
 PUSH=(3:3,6))                                       
 OUTFIL BUILD=(1,16)                                 
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7312

PostPosted: Thu Apr 02, 2015 10:57 pm    Post subject: Reply to: Copy record key on other records
Reply with quote

That should do it.

Can be touched-up a little:

Code:
//SYSIN DD *                                         
 OPTION COPY                                         
 INREC IFTHEN=(WHEN=GROUP,
                      BEGIN=(3,6,CH,NE,C' '),   
                      PUSH=(3:3,6))


It identifies the start of a group as a non-blank key, then copies the key to position three (which is the start of the key) on every record, including the first, of the group.

I didn't know what the OUTFIL was for, so I removed it :-)
Back to top
View user's profile Send private message
tdfs

New User


Joined: 31 Mar 2015
Posts: 18
Location: Italy

PostPosted: Fri Apr 03, 2015 1:38 pm    Post subject:
Reply with quote

Can I just reply with a "WOW!!!" ?

Guys, this is simply amazing!
Thank you so much!
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 help in parsing record in VBA file guptae DFSORT/ICETOOL 4 Fri Oct 11, 2019 2:31 pm
No new posts DFSMShsm Dataset Recovery with B and ... Joerg.Findeisen JCL & VSAM 0 Sat Oct 05, 2019 10:01 pm
No new posts Duplicating records in a PDS memebr/I... imcoolleo COBOL Programming 5 Mon Sep 16, 2019 3:32 pm
No new posts IEBGENER to copy from FB to VB and re... Mike.Fulton All Other Mainframe Topics 3 Sat Aug 24, 2019 7:20 am
No new posts Concatenate two files of variable rec... Thiru S DFSORT/ICETOOL 3 Wed Aug 21, 2019 11:53 pm

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