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
 

 

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 Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts Overlaying one set of charater values... Kevin Lindsley SYNCSORT 7 Sat Nov 05, 2016 3:21 am
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm


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