Multiplication using Constant



Support for NetApp SyncSort for z/OS, Visual SyncSort, SYNCINIT, SYNCLIST and SYNCTOOL

Multiplication using Constant

Postby mainframe_novice » Wed May 12, 2010 8:37 pm

Hi,

Is it possible to do the multiplication within SyncSort using Constant

I have following File

Customer_Id  Balance
A0001           12300.00
A0002           400.00


Customer Id position 1-4
Balance Position 5-13

In output I want Balance multiplied by -1 as I want to make it as a negative Balance

Customer_Id  Balance
A0001           -12300.00
A0002              -400.00
mainframe_novice
 
Posts: 35
Joined: Tue Apr 27, 2010 1:29 am
Has thanked: 0 time
Been thanked: 0 time

Re: Multiplication using Constant

 

Re: Multiplication using Constant

Postby Alissa Margulies » Wed May 12, 2010 9:44 pm

Hello mainframe_novice.

Are the Balance fields left or right justified?
Are the starting values all positive or are some already negative values?
Which release of Syncsort are you running?

Regards,
Alissa Margulies
Syncsort Mainframe Product Services
201-930-8260
zos_tech@syncsort.com
Alissa Margulies
Global moderator
 
Posts: 369
Joined: Tue Feb 26, 2008 11:15 pm
Location: USA
Has thanked: 1 time
Been thanked: 1 time

Re: Multiplication using Constant

Postby mainframe_novice » Thu May 13, 2010 1:27 am

Input file has only positive records
version is 1.3.2
balance is right justified
mainframe_novice
 
Posts: 35
Joined: Tue Apr 27, 2010 1:29 am
Has thanked: 0 time
Been thanked: 0 time

Re: Multiplication using Constant

Postby Alissa Margulies » Thu May 13, 2010 11:23 pm

If all you are doing is inserting a negative sign, then you can use this SyncSort for z/OS 1.3 job:
//SORT1 EXEC PGM=SORT                                         
//SORTIN  DD *                               
0001 12300.00                               
0002   400.00                               
//SORTOUT DD SYSOUT=*                       
//SYSOUT  DD SYSOUT=*                       
//SYSIN   DD *       
   SORT FIELDS=COPY                         
   OUTREC IFTHEN=(WHEN=INIT,BUILD=(1,4,C'-',5,9)),
          IFTHEN=(WHEN=INIT,BUILD=(1,4,5,10,SQZ=(SHIFT=RIGHT)))
/*                   

Here is the output produced:
0001 -12300.00
0002   -400.00
Alissa Margulies
Syncsort Mainframe Product Services
201-930-8260
zos_tech@syncsort.com
Alissa Margulies
Global moderator
 
Posts: 369
Joined: Tue Feb 26, 2008 11:15 pm
Location: USA
Has thanked: 1 time
Been thanked: 1 time

Re: Multiplication using Constant

Postby mainframe_novice » Fri May 14, 2010 1:17 am

Thanks Alissa !

That works .
mainframe_novice
 
Posts: 35
Joined: Tue Apr 27, 2010 1:29 am
Has thanked: 0 time
Been thanked: 0 time

Re: Multiplication using Constant

Postby mainframe_novice » Fri Jun 11, 2010 12:25 am

I was trying to multiply the zoned decimal number with -1 and was never succesful .

Since I have multiple fields like these in my file , I prefer multiply by -1 rather than putting '-' and shifting fields positions for each time .

Even substracting a number from 0 will work .

Can you please put a syncsort example for multiplication

My failed attempts involved following
multiplication:-
5,9,zd,mul,-1,zd

subtraction:-
0,zd,sub,5,9,zd

Thanks
mainframe_novice
 
Posts: 35
Joined: Tue Apr 27, 2010 1:29 am
Has thanked: 0 time
Been thanked: 0 time

Re: Multiplication using Constant

Postby dick scherrer » Fri Jun 11, 2010 1:08 am

Hello,

The fields are not zoned-decimal (ZD). . .

Try UFF. I don't have a way to test or i'd post a working sample.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: Multiplication using Constant

Postby mainframe_novice » Fri Jun 11, 2010 1:35 am

Excellent !
Thanks Dick .
It worked .

I had to put ,M4 since thec sign was displayed at the end .
Also need to restrict it's length by putting ,LENGTH=9 as I found the length was expanded .

Thanks again for your help !
mainframe_novice
 
Posts: 35
Joined: Tue Apr 27, 2010 1:29 am
Has thanked: 0 time
Been thanked: 0 time

Re: Multiplication using Constant

Postby dick scherrer » Fri Jun 11, 2010 1:58 am

You're welcome - thank you for letting us know it is working :)

d
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times


Return to Syncsort/Synctool