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
 

 

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: 331
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: 7234

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 Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 1 Fri Dec 09, 2016 4:40 am
No new posts syncsort: copy lines after the keyword shreya19 SYNCSORT 7 Fri Dec 02, 2016 9:47 am
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm


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