Hi I need some light to be thrown on using Signed variables.
in my program i am using signed variables for calculation. in the input file has the amount field is defined as:
the amount and its sign are defined seperately. i have to do some calculations by taking them together. i redefined the layout and tried to read input record into a signed variable IN-AMT-TEMP S9(9)V99.
while computing i am getting SOC7 error. How should i proceed???
Also i want to read the signed variable back to the same input layout i.e. as amount seperate and sign seperate.
Joined: 31 Aug 2005 Posts: 39 Location: St Paul,MN
What you can do is
set a flag (positive or negative) by checking the sign variable. If the sign variable is "-" then you can multiply the amount value variable by -1 and store it the result in a signed variable.
At the end of the program, you can check the value of this variable. If <0 move "-" to the sign variable and write it into the file.
Guys...please let me know if there is any other method to do this....
i tried the first one and it worked. thanks a lot.
i had previuosly tried the 3rd option also (i.e.) redefining the structure but didnt work.
i have another similar issue, where i did the following operation
C = A/B
C = V9(6)
A = 9(07)V99
B = 9(10)V99
(i) redefining the structure of A as similar to B.
(ii) declared a new group varaible D and tried to move the values in A to D as:
05 D1-var 9(10).
05 D2-var V99.
05 A1-var 9(07).
05 A2-var V99.
and then tried to move the A values to the respective D values and finally used D in place of A in the formula.
both the approaches didnt work. what can i do to do the manipulation.????