Page 1 of 2

String maths

Posted: Tue Aug 21, 2007 2:02 pm
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.

Posted: Tue Aug 21, 2007 3:52 pm
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

Posted: Wed Aug 22, 2007 2:27 am
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?

Posted: Wed Aug 22, 2007 3:20 am
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!

Posted: Wed Aug 22, 2007 3:46 am
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?

Posted: Wed Aug 22, 2007 4:11 am
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...

Posted: Wed Aug 22, 2007 4:13 am
by asitagrawal
Mine is DataStage 7.5.1A

Posted: Wed Aug 22, 2007 4:26 am
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 ??

Posted: Wed Aug 22, 2007 6:00 am
by ArndW
See what configuration changes you have made, could you post the differences shown by "smat -t" ?

Posted: Wed Aug 22, 2007 6:04 am
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

Posted: Wed Aug 22, 2007 6:09 am
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 ...

Posted: Wed Aug 22, 2007 6:13 am
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.

Posted: Wed Aug 22, 2007 6:16 am
by ArndW
Even though the parameters you've changed are rather odd they won't affect this issue. What platform are you on?

Posted: Wed Aug 22, 2007 6:34 am
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..

Posted: Wed Aug 22, 2007 6:35 am
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...