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
 
Overlaying Particular value in duplicate records

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

New User


Joined: 25 Apr 2007
Posts: 44
Location: chennai, India

PostPosted: Wed Nov 21, 2007 11:04 pm    Post subject: Overlaying Particular value in duplicate records
Reply with quote

Hi
I have below mentioned requirement.
I have a PS file which is of Lrecl = 500. i would like to sort by position's 11-14 with following conditions

1) output file should contain same No. of records
2) if there are any duplicate records with same content in pos 1-9 (there may be 'n' No. of records) and 11-14, except for the first occurences remaining values of positions 11-14 needs to be changed to a constat text

Here is the example
Input:
123456789 XXXX
123456789 XXXX
123456789 XXXX
123456789 ZZZZ
123456789 ZZZZ

Expected Output:
123456789 XXXX
123456789 YYYY
123456789 YYYY
123456789 ZZZZ
123456789 ZZZZ

Note:- only 'XXXX' needs to be changed to 'YYYY', other occurences (like zzzz) need not be changed. can anyone help me achieve this through SYNCSORT / SYNCTOOL
Back to top
View user's profile Send private message

Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Wed Nov 21, 2007 11:47 pm    Post subject:
Reply with quote

If I understand what you want correctly (and I'm not sure I do), you want to Sort by 11-14, and replace 'XXXX' with 'YYYY' for the second and subsequent occurrences of 'XXXX' for records with the same value in 1-9. If so, then here's a DFSORT job that will do that:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/500)
//SORTOUT DD DSN=...  output file (FB/500)
//SYSIN    DD    *
  OPTION EQUALS
  SORT FIELDS=(11,4,CH,A)
  OUTREC IFOUTLEN=500,
   IFTHEN=(WHEN=INIT,
     OVERLAY=(501:SEQNUM,8,ZD,RESTART=(1,14))),
   IFTHEN=(WHEN=(11,4,CH,EQ,C'XXXX',AND,501,8,ZD,GT,+1),
     OVERLAY=(11:C'YYYY'))
/*


If that's not what you want, then please explain more clearly what you do want with a better example that shows all of the variations.
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 WRITE to VSAM giving duplicate RC picus_mf CICS 1 Fri Feb 23, 2018 2:52 pm
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

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