IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Overlaying Particular value in duplicate records


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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 Developer


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

PostPosted: Wed Nov 21, 2007 11:47 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Duplicate transid's declared using CEDA CICS 3
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Join multiple records using splice DFSORT/ICETOOL 5
No new posts EZT program to build a flat file with... All Other Mainframe Topics 9
Search our Forums:

Back to Top