cvishu,
Please use CODE tags to preserve the spacing for input records. Use TO=ZD in your IFTHEN as below to get what you wanted.
Code:
INREC FIELDS=(01:555,3,5X,09:(137,12,ZD,MUL,179,13,ZD),
EDIT=(IIIIIIIIIIIIIIIIIIII))
OUTREC IFTHEN=(WHEN=(21,1,ZD,GE,5),
OVERLAY=(20:20,1,ZD,ADD,+1,TO=ZD,LENGTH=1))
SORT FIELDS=(1,3,CH,A)
SUM FIELDS=(9,20,ZD)
Quote:
I am trying to rounoff a data to 20 bytes
I am not sure what you meant by roundoff but 2 points for your attention.
1) If you have 9 at 20the position and you add +1 it becomes 10 but since you mentioned LENGTH=1, it will have 0 in the 20th position. Not sure if this is what you want. For example, for
Code:
HH1 02842752106993750000
output will be
Code:
HH1 02842752106093750000
2) Per DFSort flow diagram, your SORT FIELDS=(1,3,CH,A) and SUM FIELDS=(9,20,ZD) will be executed before your OUTREC IFTHEN. So it will remove dups first and then perform your OUTREC conditions. Is that what you wanted? Please find below actual execution order for your sort statement.
Code:
INREC FIELDS=(01:555,3,5X,09:(137,12,ZD,MUL,179,13,ZD),
EDIT=(IIIIIIIIIIIIIIIIIIII))
SORT FIELDS=(1,3,CH,A)
SUM FIELDS=(9,20,ZD)
OUTREC IFTHEN=(WHEN=(21,1,ZD,GE,5),
OVERLAY=(20:20,1,ZD,ADD,+1,TO=ZD,LENGTH=1))
Thanks for the reply , sorry abt the CODE misplacement .
Coming to the reply , yes i am aware of the flow and yes i want the output based on the flow you have mentioned, the problem i am facing is i am getting a space in the 20th byte instead of the rounded off value (20th byte + 1).
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Code:
OVERLAY=(20:(20,1,ZD,ADD,+1),LENGTH=1))
Since you didn't specify an edit mask or output format, DFSORT uses the default mask of M0 which give '2 ' (2 followed by a blank sign) for 2. Then you used LENGTH=1 so all you got was the last character (the blank). You need to use an edit mask or output format to get what you want. The easiest way would be to use:
cvishu,
I am going to take a wild guess without looking at your SYSOUT and it seems like your default ZDPRINT option is set to N.
Since you have your expected results I wouldn't ask much but If you are still curious as to why you see F,G,C in your output, try to add OPTION ZDPRINT before your sort control statement and check the results.
Not sure if you shoud get H in the second last record.