View previous topic :: View next topic
|
Author |
Message |
venkatarao
New User
Joined: 19 Dec 2004 Posts: 23 Location: hyderabad
|
|
|
|
Hi,
In one File i would like to set one field(having length 1 byte) value to 'Y' using DFSORT utility, if the Field Value in the File is 'N'.
I am not sure how to use IF condition in Sort to Reset that value after checking value of that Field.
Field position in the file is 2585.
Thanks
venkat
Warning: Do not use Forum name as Topic Title. Title Edited |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
Back to top |
|
|
venkatarao
New User
Joined: 19 Dec 2004 Posts: 23 Location: hyderabad
|
|
|
|
Hi,
yes. it's almost similar.
Here i am asking about how to Reset only perticular records(value which is having 'N') by specifing if condition in DFSort.
pls let me know if need any information.
Thanks
Venkat |
|
Back to top |
|
|
raak
Active User
Joined: 23 May 2006 Posts: 166 Location: chennai
|
|
|
|
Hey,
Try this one..
Code: |
SORT FIELDS=COPY
OUTREC FIELDS=(1:1,2584,2585:2585,1,CHANGE=(1,C'N',C'Y'))
|
|
|
Back to top |
|
|
raak
Active User
Joined: 23 May 2006 Posts: 166 Location: chennai
|
|
|
|
oops... sorry..u have to add this NOMATCH to get the correct result for ur requirement..
Code: |
SORT FIELDS=COPY
OUTREC FIELDS=(1:1,2584,2585:2585,1,CHANGE=(1,C'N',C'Y'),NOMATCH=(2585,1))
|
the earlier code will give an abend if any value except N comes in that particular position.
When u add NOMATCH, the records which has a different value than N in position 2585 will have the same value.. i.e. it won't get changed. |
|
Back to top |
|
|
venkatarao
New User
Joined: 19 Dec 2004 Posts: 23 Location: hyderabad
|
|
|
|
Hi raak,
can u please explain the given syntax.
OUTREC FIELDS=(1:1,2584,2585:2585,1,CHANGE=(1,C'N',C'Y'),NOMATCH=(2585,1))
I am not clear how u r spcifing positions 1:1,2584,2585:2585,1
Thanks
venkat |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Venkat,
Here's a DFSORT job that will do what you asked for:
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file
//SORTOUT DD DSN=... output file
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=(2585,1,CH,EQ,C'N'),OVERLAY=(2585:C'Y'))
/*
|
|
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
raak,
Your "solution" will truncate any bytes in the input file past position 2585 so it only works if the LRECL is 2585. You would need to add in the other input positions to make it work for an LRECL greater than 2585. But for this kind of thing, it's much easier to use DFSORT's OVERLAY function so you don't have to worry about the positions before and after the position to be changed. Also DFSORT's newer IFTHEN/OVERLAY function is easier to use then DFSORT's older CHANGE function. You need to update your bag of tools. |
|
Back to top |
|
|
|