Focal Point
[SOLVED]Can I use the 99.99999 to identify a decimal place?

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/5337093926

March 11, 2013, 03:36 PM
Greg
[SOLVED]Can I use the 99.99999 to identify a decimal place?
I have a report that runs against a flatfile and only generates data if it finds an error. This is a report we actually want to come back empty.

Right now it just checks the field F11 to make sure it is not equal to 0.

WHERE (ELAPSED_TIME_CSV.ELAPSED_TIME_CSV.F2 IS-NOT MISSING )  
OR  (ELAPSED_TIME_CSV.ELAPSED_TIME_CSV.F4 NE '0')  
OR  (ELAPSED_TIME_CSV.ELAPSED_TIME_CSV.F7 IS-NOT MISSING )  
OR  (NOT ELAPSED_TIME_CSV.ELAPSED_TIME_CSV.F8 IN ('A'))  
OR  (ELAPSED_TIME_CSV.ELAPSED_TIME_CSV.F11 EQ 0) 
OR  (ELAPSED_TIME_CSV.ELAPSED_TIME_CSV.F12 IS-NOT MISSING )


Now I need to check it to make sure the last 5 digits are all zero's. This is payroll data and the system the flatfile is imported to only does time in 1/10th of an hour (6, 12, 18, 24, 30, etc) shown in the flat file in decimal 10ths as .1 .2 .3 .4 etc.

In this example:

"REG","10.250000","","0"""
 "REG","10.500000","","0","""


Line one would be in the report as it is not a tenth, but line 2 would pass.

So I need another OR statement for F11 that will make sure
XX.X99999 that the 9 decimal places are equal to Zero.

Am I even barking up the right tree?

This message has been edited. Last edited by: Greg,


prod: WF 7.7.03 platform IIS on Windows 2007, databases: Oracle, , MSSQL

March 11, 2013, 04:57 PM
Waz
Whats the format of the field ?

You could right justify the field, then pull the last 5 characters to check that they are all zeros.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

March 11, 2013, 05:12 PM
Greg
They are all Alpha since the reports runs against a flat file.


prod: WF 7.7.03 platform IIS on Windows 2007, databases: Oracle, , MSSQL

March 11, 2013, 05:13 PM
Doug
Or EDIT([thefield]) and check for the specific characters in the resultant string...
IF F11 EQ '00.000000' THEN 'This' ELSE 'That' ;

March 11, 2013, 05:21 PM
Greg
Perhaps there is a way to SUM the value of that field to make sure it is divisible by 10? and therefore correct? .1 .2 .3 .4 etc.


prod: WF 7.7.03 platform IIS on Windows 2007, databases: Oracle, , MSSQL

March 11, 2013, 05:32 PM
Doug
Change it to numeric and do the math?
March 11, 2013, 06:25 PM
Waz
Right Justify and pull the last 5 chars.

EX -LINES 7 EDAPUT MASTER,TST_DATA,CV,FILE
FILENAME=TST_DATA, SUFFIX=COM,$
SEGNAME=TST_DATA, $
  FIELD=FIELD1 ,ALIAS=  ,A20 ,A20 ,$
  FIELD=FIELD2 ,ALIAS=  ,A20 ,A20 ,$
  FIELD=FIELD3 ,ALIAS=  ,A20 ,A20 ,$
  FIELD=FIELD4 ,ALIAS=  ,A20 ,A20 ,$

FILEDEF TST_DATA DISK tst_data.ftm (RECFM V
SET PCOMMA=ON

EX -LINES 3 EDAPUT FOCTEMP,TST_DATA,CV,FILE
"REG","10.250000","","0"
"REG","10.500000","","0"

-RUN

TABLE FILE TST_DATA
PRINT *
WHERE EDIT(RJUST(20,FIELD2,'A20'),'$$$$$$$$$$$$$$$99999') NE '00000'
END



Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

March 12, 2013, 09:18 AM
Greg
Since my F11 field is A255V, will I need 250 $ dollar signs for the RJUST statement.

Like this:

 WHERE EDIT(RJUST(255,FIELD11,'A255V'),'$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$99999') NE '00000' 



prod: WF 7.7.03 platform IIS on Windows 2007, databases: Oracle, , MSSQL

March 12, 2013, 10:33 AM
Tewy
You could reverse the string and then it would be the first 5 chars you need

EDIT(REVERSE(255,RJUST(255,TXT,'A255'),'A255'),'99999');


WF 7.6.11
Output: HTML, PDF, Excel
March 12, 2013, 04:37 PM
Waz
Or you could use SUBSTR.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

March 13, 2013, 12:09 PM
Greg
quote:
Originally posted by Waz:
Or you could use SUBSTR.


This turned out to be the solution.

DEFINE DECIMAL_STRING_6/A6= GETTOK(F11X, 10, 2, '.', 6, DECIMAL_STRING);

THis count the 6 spaces to the right of the decimal and made sue the last 5 were all Zero's.


prod: WF 7.7.03 platform IIS on Windows 2007, databases: Oracle, , MSSQL

March 13, 2013, 07:16 PM
Dan Satchell
Function CHKFMT might be another option:

F11_CHECK/I1 = CHKFMT(10,F11,'99.900000','I1');

F11_CHECK will be zero if the value in F11 fits the mask, otherwise it contains the position of the first character failing the mask.


WebFOCUS 7.7.05