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 MXG - Processing Compressed DB2 SMF r... vasanthz All Other Mainframe Topics 2 Thu May 10, 2018 12:47 am
No new posts Duplicate PARM on OUTFIL sancraig16 SYNCSORT 11 Thu Apr 05, 2018 10:25 pm
No new posts Extract the records with a PD field's... sudhakar84 DFSORT/ICETOOL 11 Mon Apr 02, 2018 7:26 pm
No new posts Merge 2 records sancraig16 SYNCSORT 19 Tue Mar 27, 2018 8:17 pm
No new posts Copy set of records based on condition krish.deepu SYNCSORT 2 Thu Mar 08, 2018 11:39 am

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