Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
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
 
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: 414
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: 7314

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 add sequence number for duplicate rec... SRUTHI DRAVIDAMANI COBOL Programming 11 Thu Feb 22, 2018 5:37 pm
No new posts how to add the amount for duplicate r... SRUTHI DRAVIDAMANI COBOL Programming 6 Wed Feb 21, 2018 7:21 pm
No new posts Merging records, but not all the time prino DFSORT/ICETOOL 17 Sat Feb 17, 2018 4:20 pm
No new posts Need all records with high key kalidasvs SYNCSORT 15 Fri Feb 09, 2018 10:38 pm
No new posts Copying only first and last word from... chandan.inst SYNCSORT 4 Wed Jan 31, 2018 4:19 pm

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