View previous topic :: View next topic
Author
Message
bijoybabu83 New User Joined: 15 Jan 2007Posts: 36 Location: Kerala
I am performing a numeric operation on some fields in a file of length 133 using OUTFIL.
The operation being performed is :-
1. Subtract two Zoned decimal fields in the input file at positions 54 to 63(54,10) and at position 64-73 (64,10).
2. Now divide the answer by the same field in 64-73 (64,10).
The two values are :- 0000009087 and 0000009012.
Please find the outfil statement that i have written to do the arithmetic calculation.
OUTFIL FNAMES=OUTPUT1,OUTREC=(1,73,74:(54,10,ZD,SUB,64,10,ZD),
DIV,64,10,ZD,EDIT=(STTTTTTTTT.TTTT),SIGNS=(,-),
LENGTH=15,45X).
For the above values, the output of this operation is 000000000.0000 whereas the actual values should be 0000000000.0800.
Please help me to find out why it is printing wrong values.
Back to top
Skolusu Senior Member Joined: 07 Dec 2007Posts: 2205 Location: San Jose
bijoybabu83 wrote:
The two values are :- 0000009087 and 0000009012.
For the above values, the output of this operation is 000000000.0000 whereas the actual values should be 0000000000.0800 .
Please help me to find out why it is printing wrong values.
how did you end up with 0000000000.0800?
(9087-9012)/9012 = 75/9012 = 0.008322237
If that is what you want then the following Control cards will give you the desired results
Code:
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL FNAMES=OUTPUT1,
OVERLAY=(74:(+10000,MUL,(54,10,ZD,SUB,64,10,ZD)),
DIV,64,10,ZD,EDIT=(STTTTTTTTT.TTTT),SIGNS=(,-),45X)
/*
Back to top
bijoybabu83 New User Joined: 15 Jan 2007Posts: 36 Location: Kerala
Hi Skolusu, I really appreciate your help. Your solution is exactly what I wanted. Thank you so much
Back to top
Please enable JavaScript!