Hi,
How can we change the sign of a Packed decimal field using SORT ? Can we multiply by -1 or is there any other solution to this?
The details are as follows: LRECL=500, field size is 8 bytes: S9(10)V9(5) comp-3. And position of the field=15.
Please help.
How can we change the sign using SORT?
-
- Global Moderator
- Posts: 490
- Joined: Sun Aug 25, 2013 7:24 pm
Re: How can we change the sign using SORT?
I'd subtract it from zero. You have to tell SORT the size and type of the result. Yes, you can multiply by -1.
Re: How can we change the sign using SORT?
Thanks William. I've used the following. Please if it's correct or is there a better way of doing it:
How do you do it using subtraction?
Code: Select all
OPTION COPY
INREC IFTHEN=(WHEN=(15,8,PD,LT,0),
OVERLAY=(15:15,8,PD,MUL,-1,TO=PD,LENGTH=8))
Code: Select all
OPTION COPY
INREC IFTHEN=(WHEN=(15,8,PD,LT,0),
OVERLAY=(15:15,8,??,SUB,??...))
Re: How can we change the sign using SORT?
Hi William,William Collins wrote:I'd subtract it from zero. You have to tell SORT the size and type of the result. Yes, you can multiply by -1.
Could you please help me in knowing how would you substract from zero using SORT statements? I'm trying to figure it out but did not get it.
Code: Select all
OPTION COPY
INREC IFTHEN=(WHEN=(15,8,PD,LT,0),
OVERLAY=(15:15,8,??,SUB,??...))
Create an account or sign in to join the discussion
You need to be a member in order to post a reply
Create an account
Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute