View previous topic :: View next topic
|
Author |
Message |
Rajen
New User
Joined: 05 May 2005 Posts: 61
|
|
|
|
Hi,
I need to reverse the sign of a variable having picture clause as
PIC S9(6) and PIC S9(5).
For example, if the input values are as below.
-15
126
32
81
the output should be
15
-126
- 32
- 81
I guess we need to subtract this values from zero (0 - Variable) or else we need to multiple the variable with -1.
The varialbe starts at position 30 and is of length 6 bytes.
Please let me know if it is not clear. |
|
Back to top |
|
|
demora
New User
Joined: 12 Dec 2006 Posts: 4 Location: Cleveland, OH
|
|
|
|
You can also multiply variable*-1 to get the reverse sign.
Not sure how to do it in SORT or if you can....What does the file look like with the sign?
If it's '-000015' in the file and ' 000085' then you could do an OUTREC in sort to change them. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
YOu can use DFSORT control statements like this to multiply the value by -1:
Code: |
OPTION COPY
INREC OVERLAY=(30:30,6,PD,MUL,-1,TO=PD,LENGTH=6)
|
|
|
Back to top |
|
|
|