String maths

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

asitagrawal
Premium Member
Premium Member
Posts: 273
Joined: Wed Oct 18, 2006 12:20 pm
Location: Porto

String maths

Post by asitagrawal »

Hi,


I am using String Maths for arithmetic operations on bigger numbers,
but I am facing a problem with SSUB:
Example:

Code: Select all

SSUB(1234567890.12,1234567890.2) is resulting in 0 instead of -0.08
i,e SSUB is returning a 0 when the difference is less than -0.1

Getting this difference calculation right, is vary critical for my process.

Please advice.
Share to Learn, and Learn to Share.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

I'm not at a DS system right now to check, but could you see if the computation would work if you do it on integers and not real numbers? Then you could remove the decimals in the string and subsequently put them back into the result via division
robvonk
Participant
Posts: 7
Joined: Tue Sep 20, 2005 1:34 am
Contact:

Post by robvonk »

I tried the 'Ans = SSUB(1234567890.12,1234567890.2)' code in a routine and it gives back 0.08 correctly.

Are you trying to put it into an integer?
asitagrawal
Premium Member
Premium Member
Posts: 273
Joined: Wed Oct 18, 2006 12:20 pm
Location: Porto

Post by asitagrawal »

robvonk wrote:I tried the 'Ans = SSUB(1234567890.12,1234567890.2)' code in a routine and it gives back 0.08 correctly.

Are you trying to put it into an integer?
The results are confusing...
My test routine is:

Code: Select all

Ans = Arg1-Arg2:' ':SSUB(Arg1,Arg2):' ':SDIV(SSUB(SDIV(Arg1,1,2),SDIV(Arg2,1,2)),1,2):' ':TRIM(Arg1,' ','B')

PRINT -1*Arg1
PRINT SMUL(-1,Arg1)

if SDIV(SSUB(Arg1,Arg2),1,2) < 0 
THEN
PRINT '1'
END
ELSE
PRINT  '2'
END

if SDIV(SSUB(Arg1,Arg2),1,2) = 0 
THEN
PRINT '3'
END
ELSE
PRINT  '4'
END
The results are like this

I hope one can notice the difference...

Also, let me correct my statement too...

Earlier I wrote:

Code: Select all

i,e SSUB is returning a 0 when the difference is less than -0.1 
Actually,

Code: Select all

i,e SSUB is returning a 0 when the difference is [b]more[/b] than -0.1 
Just got confused by the negative signs, :wink: , sorry!
Share to Learn, and Learn to Share.
robvonk
Participant
Posts: 7
Joined: Tue Sep 20, 2005 1:34 am
Contact:

Post by robvonk »

I get these results.

It seems that my results are as expected.

We're using Datastage server 7.5.1 on windows. Maybe there's a bug in your version?
asitagrawal
Premium Member
Premium Member
Posts: 273
Joined: Wed Oct 18, 2006 12:20 pm
Location: Porto

Post by asitagrawal »

robvonk wrote:I get these results.

It seems that my results are as expected.

We're using Datastage server 7.5.1 on windows. Maybe there's a bug in your version?
I wish I had your machine :)
Hey is it possible for you to share the Hardware, Operating System and DataStage version details please...
Share to Learn, and Learn to Share.
asitagrawal
Premium Member
Premium Member
Posts: 273
Joined: Wed Oct 18, 2006 12:20 pm
Location: Porto

Post by asitagrawal »

Mine is DataStage 7.5.1A
Share to Learn, and Learn to Share.
asitagrawal
Premium Member
Premium Member
Posts: 273
Joined: Wed Oct 18, 2006 12:20 pm
Location: Porto

Post by asitagrawal »

I have tried the same routine on a differrent server hosting 7.5, but I am getting same results....
Can anyone explain what could be wrong ??
Share to Learn, and Learn to Share.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

See what configuration changes you have made, could you post the differences shown by "smat -t" ?
asitagrawal
Premium Member
Premium Member
Posts: 273
Joined: Wed Oct 18, 2006 12:20 pm
Location: Porto

Post by asitagrawal »

ArndW wrote:See what configuration changes you have made, could you post the differences shown by "smat -t" ?
Hi ArndW,

I dont know how to execute "smat -t".
Please guide me. I am on Windows machine.

Thanks
Share to Learn, and Learn to Share.
asitagrawal
Premium Member
Premium Member
Posts: 273
Joined: Wed Oct 18, 2006 12:20 pm
Location: Porto

Post by asitagrawal »

Sorry..

I think I have found it... Below are the results:

Code: Select all

Current tunable parameter settings:
     MFILES         =   150
     T30FILE        =   200
     OPENCHK        =   1
     WIDE0          =   0x3dc00000
     UVTEMP         =   D:\Ascential\DataStage\Engine\UVtemp
     SCRMIN         =   3
     SCRMAX         =   5
     SCRSIZE        =   512
     QDEPTH         =   16
     HISTSTK        =   99
     QSRUNSZ        =   2000
     QSBRNCH        =   4
     QSDEPTH        =   8
     QSMXKEY        =   32
     TXMODE         =   0
     LOGBLSZ        =   512
     LOGBLNUM       =   8
     LOGSYCNT       =   0
     LOGSYINT       =   0
     TXMEM          =   32
     OPTMEM         =   64
     SELBUF         =   4
Press any key to continue...
     FSEMNUM        =   23
     GSEMNUM        =   97
     PSEMNUM        =   64
     FLTABSZ        =   11
     GLTABSZ        =   75
     RLTABSZ        =   75
     RLOWNER        =   300
     PAKTIME        =   300
     NETTIME        =   5
     QBREAK         =   1
     VDIVDEF        =   1
     UVSYNC         =   0
     BLKMAX         =   8192
     PICKNULL       =   0
     SYNCALOC       =   1
*    MAXRLOCK       =   74
     ISOMODE        =   1
     PKRJUST        =   0
     PROCACMD       =   0
     PROCRCMD       =   0
     PROCPRMT       =   0
     ALLOWNFS       =   1
     CSHDISPATCH    =   NOT_SUPPORTED
Press any key to continue...
     SHDISPATCH     =   NOT_SUPPORTED
     DOSDISPATCH    =   CMD.EXE
*    NLSMODE        =   1
     NLSREADELSE    =   1
     NLSWRITEELSE   =   1
     NLSDEFSOCKMAP  =   NONE
     NLSDEFFILEMAP  =   MS1252
     NLSDEFDIRMAP   =   MS1252-CS
     NLSNEWFILEMAP  =   NONE
     NLSNEWDIRMAP   =   MS1252
     NLSDEFPTRMAP   =   MS1252
     NLSDEFTERMMAP  =   MS1252
     NLSDEFDEVMAP   =   MS1252
     NLSDEFGCIMAP   =   NONE
     NLSDEFSRVMAP   =   MS1252-CS
     NLSDEFSEQMAP   =   MS1252
     NLSOSMAP       =   MS1252-CS
     NLSLCMODE      =   1
     NLSDEFUSERLC   =   US-ENGLISH
     NLSDEFSRVLC    =   US-ENGLISH
     LAYERSEL       =   0
     OCVDATE        =   0
     MODFPTRS       =   1
Press any key to continue...
     THDR512        =   0
     UDRMODE        =   0
*    UDRBLKS        =   0
     MAXERRLOGENT   =   100
     JOINBUF        =   4095
     64BIT_FILES    =   0
     TSTIMEOUT      =   60
     PIOPENDEFAULT  =   0
     MAXKEYSIZE     =   768
     SMISDATA       =   0
     EXACTNUMERIC   =   15
     MALLOCTRACING  =   0
     CENTURYPIVOT   =   1930
     SPINTRIES      =   0
     SPINSLEEP      =   0
     DISKCACHE      =   -1
     DCBLOCKSIZE    =   16
     DCMODULUS      =   256
     DCMAXPCT       =   80
     DCFLUSHPCT     =   80
     DCCATALOGPCT   =   50
     DCWRITEDAEMON  =   0
     DMEMOFF        =   0x0
Press any key to continue...
     PMEMOFF        =   0x0
     CMEMOFF        =   0x0
     NMEMOFF        =   0x0
     AUTHENTICATION =   0
     IMPERSONATION  =   0
     INSTANCETAG    =   dae
     HOSTFILELOCKING=   0
I hope it is datastage wide and NOT project specific ...
Share to Learn, and Learn to Share.
robvonk
Participant
Posts: 7
Joined: Tue Sep 20, 2005 1:34 am
Contact:

Post by robvonk »

We have Datastage 7.5.1 (no A mentioned) running on Windows 2000.

I can't find a 'smat' executable on the client.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Even though the parameters you've changed are rather odd they won't affect this issue. What platform are you on?
asitagrawal
Premium Member
Premium Member
Posts: 273
Joined: Wed Oct 18, 2006 12:20 pm
Location: Porto

Post by asitagrawal »

ArndW wrote: What platform are you on?
DataStage: Server Edition 7.5.1A
Operating System: Windows 2003 Server Enterprise Edition SP1

Please let me know if you are looking for any other information also..
Share to Learn, and Learn to Share.
asitagrawal
Premium Member
Premium Member
Posts: 273
Joined: Wed Oct 18, 2006 12:20 pm
Location: Porto

Post by asitagrawal »

robvonk wrote:We have Datastage 7.5.1 (no A mentioned) running on Windows 2000.

I can't find a 'smat' executable on the client.
smat.exe is available in ..\Ascential\DataStage\Engine\Bin\

Please do post your results...
Share to Learn, and Learn to Share.
Post Reply