How can we change the sign using SORT?

IBM's Sort Product, ICETOOL, ICEMAN and ICEGENER.
Post Reply
Hari Om
Registered Member
Posts: 11
Joined: Tue Nov 26, 2013 10:39 am

How can we change the sign using SORT?

Post by Hari Om »

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.
William Collins
Global Moderator
Global Moderator
Posts: 490
Joined: Sun Aug 25, 2013 7:24 pm

Re: How can we change the sign using SORT?

Post by William Collins »

I'd subtract it from zero. You have to tell SORT the size and type of the result. Yes, you can multiply by -1.
Hari Om
Registered Member
Posts: 11
Joined: Tue Nov 26, 2013 10:39 am

Re: How can we change the sign using SORT?

Post by Hari Om »

Thanks William. I've used the following. Please if it's correct or is there a better way of doing it:

Code: Select all

OPTION COPY 
   INREC IFTHEN=(WHEN=(15,8,PD,LT,0), 
      OVERLAY=(15:15,8,PD,MUL,-1,TO=PD,LENGTH=8))
How do you do it using subtraction?

Code: Select all

OPTION COPY 
   INREC IFTHEN=(WHEN=(15,8,PD,LT,0), 
      OVERLAY=(15:15,8,??,SUB,??...))
Hari Om
Registered Member
Posts: 11
Joined: Tue Nov 26, 2013 10:39 am

Re: How can we change the sign using SORT?

Post by Hari Om »

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.
Hi William,

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,??...))
Post Reply

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

Register

Sign in

Return to “IBM DFSort, ICETOOL, ICEMAN, ICEGENER.”