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
 
Add Duplicate records

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
thesumitk

Active User


Joined: 24 May 2013
Posts: 147
Location: INDIA

PostPosted: Fri Dec 27, 2013 2:45 pm    Post subject: Add Duplicate records
Reply with quote

Hi All,

I have a scenario like below

Code:
Input 

1234ABCDEFGHI
5678JKLMNOPQR

Output

1234DABCDEFGHI
1234HABCDEFGHI
5678DJKLMNOPQR
5678HJKLMNOPQR



I want to Duplicate each record in the file so in output file there will be 2 records for each .. first willbe having a D at 5th position and second will be having a H in 5th position .. like above

I am planing to do it with SYNCSORT . .and was wondering if any one can give an idea or have done this kind of sort earlier . I tried searchign it in Docs or google but couldnt find much to implement

Many thanks in advance !!
Back to top
View user's profile Send private message

thesumitk

Active User


Joined: 24 May 2013
Posts: 147
Location: INDIA

PostPosted: Fri Dec 27, 2013 2:55 pm    Post subject:
Reply with quote

In Addition to my below email.. I wanted to do it in one STEP of SORT only
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7312

PostPosted: Fri Dec 27, 2013 3:33 pm    Post subject: Reply to: Add Duplicate records
Reply with quote

Have a look at BUILD on OUTFIL which supports the Slash Operator (/) which allows you to write multiple lines from one input record.
Back to top
View user's profile Send private message
thesumitk

Active User


Joined: 24 May 2013
Posts: 147
Location: INDIA

PostPosted: Fri Dec 27, 2013 5:35 pm    Post subject:
Reply with quote

Thanks a bunch for the idea Bill ..

I was able to do it

Code:
SORT FIELDS=COPY                                         
OUTFIL OUTREC=(1:1,4,C'D',6:5,10,16:15,4,C'D',21:19,10,/,
 1:1,4,C'H',6:5,10,16:15,4,C'H',21:19,10)


Code'd
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7312

PostPosted: Fri Dec 27, 2013 5:56 pm    Post subject: Reply to: Add Duplicate records
Reply with quote

Code:
SORT FIELDS=COPY                                         
OUTFIL BUILD=(1,4,C'D',X,5,10,15,4,C'D',X.19,10,
              /,
              1,4,C'H',X,5,10,15,4,C'H',X.19,10)


You can make things clearer by using BUILD instead of the OUTREC (so it can't be confused with OUTREC) and not using all the columns. Also by indentation.

I'd also use symbols/SYMNAMES to avoid the repeated code, but I like doing it the easy (to understand and maintain) way.
Back to top
View user's profile Send private message
thesumitk

Active User


Joined: 24 May 2013
Posts: 147
Location: INDIA

PostPosted: Fri Dec 27, 2013 10:00 pm    Post subject:
Reply with quote

Sure..Thanks
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
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 Compare duplicate records in same file pshongal DFSORT/ICETOOL 3 Fri Aug 09, 2019 9:37 am
No new posts How to count duplicate key records co... sergeyken SYNCSORT 0 Thu Jul 25, 2019 8:03 pm
This topic is locked: you cannot edit posts or make replies. Removing duplicate record based on th... Nilanjan Sikdar DFSORT/ICETOOL 4 Mon Jul 22, 2019 8:29 pm

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