Posted: Wed Mar 23, 2005 1:24 pm Post subject: Replacing characters in a record
So here's my dilemma. I have a file which is too large to simply edit. I have a single record in that file in which I need to change one value. I have the file layout, and criteria on which to find the file (three fields). Based on a match of these three fields, I need to change the value in a fourth field from x to y.
I was wondering if there is any way to do this in a single sort, and if so, how? This is something that I need to have done today to several files and it would be much easier to use a sort than to write a COBOL program to do this. It would also be a useful tool for the future for my colleagues & I.
Thanks, _________________ Robert Tighe
Legacy Systems Analyst
Keane Canada, Inc.
Robert_F_Tighe@keane.com
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Wed Mar 23, 2005 2:00 pm Post subject:
You can do this quite easily with the new IFTHEN and OVERLAY parameters of DFSORT's INREC, OUTREC or OUTFIL statement available with z/OS DFSORT V1R5 PTF UQ95214 or DFSORT R14 PTF UQ95213 (Dec, 2004). For complete information on all of the new DFSORT and ICETOOL functions available with the Dec, 2004 PTF, see:
You didn't give any details, so I'll set up an example to give you the idea.
If you want to find a record that has 'XX' in positions 5-6 and 'Y' in position 10 and 'ZAB' in positions 15-17, and change positions 20-22 in that record to 'YES', you can use the following DFSORT job:
Code:
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
R01 XQ Y ZAB NOO
R02 XX Y ZAB NOO
R03 XX Z ZAB NOO
R04 XX Y ZAC NOO
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=(5,2,CH,EQ,C'XX',AND,10,1,CH,EQ,C'Y',AND,
15,3,CH,EQ,C'ZAB'),OVERLAY=(20:C'YES'))
/*
SORTOUT would have:
Code:
R01 XQ Y ZAB NOO
R02 XX Y ZAB YES
R03 XX Z ZAB NOO
R04 XX Y ZAC NOO
Note that you can use any INCLUDE condition for WHEN, so the criteria can be simple or very complex.
If you need help with a specific example, give me the details. _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Wed Mar 23, 2005 3:15 pm Post subject:
Tiggy,
The error messages indicate you don't have DFSORT's Dec, 2004 PTF installed. Ask your System Programmer to install it (it's free).
Note that the method using CHANGE that Kolusu shows works when the criteria involves matching a set of character strings, but becomes problematical when the criteria is more complex such as when it involves numeric comparisons (ZD field gt +250), or when OR must be used ((A OR B OR C) AND D), etc). IFTHEN can handle all of these cases! _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
Posted: Wed Mar 30, 2005 7:19 am Post subject:
Rishikesh_u,
The orginal poster wanted to validate 3 fileds at different locations and change another field. Using Outrec fields I put the 3 fields together at the end of every record, so that he can validate the 3 fields as one single field.
Quote:
and can you also explain how the below works and how did you arrive at
C'5TDZA22C05S2575262005020432097'.
Look at 4th post from top in this topic. He was checking for
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum