David P
Active User
Joined: 11 Apr 2005 Posts: 106 Location: Cincinnati Ohio
|
|
|
|
Hi,
I have a requirement to sum two fields and check if the sum is equal to the third field. If it is equal I want to replace the third field with zeros.
I want to achieve this in one step. (using DFSORT or ICETOOL)
ex.
Input
Code: |
Field1 Field2 Field3
45 12 57
43 10 53
42 10 50
|
Out put should look like
Code: |
Field1 Field2 Field3
45 12 00
43 10 00
42 10 50
|
Position of fields : Field1 1-10 Field2 11-20 Field3 21-30
RECFM =FB, LRECL=80 (for both Input and Output)
Please let me know if any more details from my side is required.
David P. |
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
You didn't indicate the format of the numeric values (ZD, PD, ...). The way you show them they seem to be 2 digits left-aligned in a 10-byte field. Assuming that's the way they really look, you can use a DFSORT job like this to do what you asked for:
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
45 12 57
43 10 53
42 10 50
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC IFOUTLEN=80,
IFTHEN=(WHEN=INIT,
OVERLAY=(81:1,10,UFF,ADD,11,10,UFF,TO=FS,LENGTH=10)),
IFTHEN=(WHEN=(21,10,UFF,EQ,81,10,UFF),
OVERLAY=(21:C'00',8X))
/*
|
If the numeric values are actually in some other format, you can change the job appropriately. Or tell me what format they are, and what the values really look like for input and output, and I'll show you how to change the job. |
|