Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
Posted: Tue Oct 04, 2005 4:59 am Post subject:
Eureka19,
Using CHANGE operator you can check for any literal value (in any position) and change it to another literal. The only problem with CHANGE parameter is that, it does not support variables, since you need to hardcode all possible cases in the sort card.
Ok...Here is the sort card for your case.
Code:
SORT FIELDS=(p,l,f,a)
OUTREC FIELDS=(1,16 * Copy first 16 bytes as it is *
1,9,CHANGE=(1, * Check in first 9 bytes & Change to 1 byte *
C'123456789',C'N'), * Change literal 123456789 to 'N' *
NOMATCH=(17,1)) * Else copy contents of 17th column *
Note: The above card will replace the contents of Column 17 to 'N' if Key = 123456789. This is done irrespective of the original contents of Column 17.
If you have a special case like this, Then you need to change the card as shown below
Code:
IF KEY=123456789 AND COL-17 = 'Y' THEN
Change 'Y' to 'N'
Code:
INREC FIELDS=(1,16, * Copy first 16 bytes as it is *
17,1, * Original contents of Col 17 *
1,9) * Copy first 9 bytes again @ col 18 *
OUTREC FIELDS=(1,16 * Copy first 16 bytes as it is *
17,10,CHANGE=(1, * Check 10 bytes from 17 *
C'Y123456789',C'N'), * Change literal Y123456789 to 'N' *
NOMATCH=(17,1)) * Else copy contents of 17th column *
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Tue Oct 04, 2005 10:36 am Post subject:
DFSORT's IFTHEN and OVERLAY functions are much more flexible than CHANGE for doing this kind of thing, especially when it comes to multiple conditions.
The first case could be done like this with DFSORT:
You'll need z/OS DFSORT V1R5 PTF UQ95214 or DFSORT R14 PTF UQ95213 (Dec, 2004) in order to use DFSORT's IFTHEN and OVERLAY. Only DFSORT has these functions, so if you don't have DFSORT, you won't be able to use them. If you do have DFSORT, but you don't have the Dec, 2004 PTF, ask your System Programmer to install it (it's free). For complete details on all of the new DFSORT and ICETOOL functions available with the Dec, 2004 PTF, see:
All times are GMT - 5 Hours Goto page Previous1, 2
Page 2 of 2
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