Focal Point
[SOLVED] Problem with -READ

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

December 01, 2010, 03:38 PM
swetha
[SOLVED] Problem with -READ
Hello,
one of my fields in the database is in P24.7 format.I am doing a -READ on that field.
  
TABLE FILE STAGE
PRINT 
    PROB AS 'V9'
WHERE KEY EQ '&SALES';
ON TABLE HOLD AS HEAD FORMAT ALPHA
END

-READ HEAD &V9.A30.
-SET &A_PROB = EDIT(&V9,'99999999999999999999999999999999');
-SET &MY_PROB = TRUNCATE(&A_PROB);
-SET &MY_PROB1 = &MY_PROB * 100;


The field I am talking about is PROB.
I tried using -READ HEAD &V9.P24.7.,but that does'nt work.
Can somebody correct me.
Thanks
Swetha.

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


WebFOCUS 7.6.7
windows
Html,Pdf and Excel
December 01, 2010, 03:50 PM
dbeagan
Following the

END

Place a

-READ


WebFOCUS 8.2.06
December 01, 2010, 04:10 PM
FrankDutch
if you are not sure about the exact length of the field you can put a HOLD command

? HOLD HEAD

start the report with

-SET %ECHO=ALL;

and then you will see what length your field is (I suppose it is A24)




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

December 01, 2010, 04:21 PM
Waz
Actually you should have a -RUN after the END from the TABLE FILE.

Also you are READING 30 characters from the file, as the field, and the file will only be 24 bytes, this will also cause problems.

Change the -READ to .A24.

If you want to know how many bytes are in the record, change the HOLD to SAVE.


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!

December 01, 2010, 08:03 PM
Dan Satchell
If you want to retain decimal places in calculations made in Dialogue Manager, you will need to set DMPRECISION to an appropriate number of decimal places (ex.: SET DMPRECISION = 7). Otherwise DM will truncate the decimals and display calculated variables as integers.


WebFOCUS 7.7.05
December 02, 2010, 04:28 AM
PBax
Just my 2penneth...

I always add -RUN after :

the Hold file
after -READ

this can resolve many problems - I dont have any p24 data to hand to test.

TABLE FILE STAGE
PRINT
PROB AS 'V9'
WHERE KEY EQ '&SALES';
ON TABLE HOLD AS HEAD FORMAT ALPHA
END

-RUN

-READ HEAD &V9.A30.
-RUN

-SET &A_PROB = EDIT(&V9,'99999999999999999999999999999999');
-SET &MY_PROB = TRUNCATE(&A_PROB);
-SET &MY_PROB1 = &MY_PROB * 100;


81.05 All formats
December 02, 2010, 08:21 AM
dbeagan
PBax,

What problems does the -RUN after the -READ solve? It would appear to be unnecessary.

Thanks.


WebFOCUS 8.2.06
December 02, 2010, 09:34 AM
jgelona
the -RUN closes the file.

You need to download the WebFOCUS Developing Application Manuals for your release.

With the way you have coded this (HOLDFORMAT ALPHA) all the data in your file is alpha-numeric. There is no binary data. The correct way to code the -READ is:
-READ HEAD &V9.24.


All you need between the .. is the length of the field.

Also, the P, D and F formats, the number following the P, D or F is the total length of the field including any embedded commas, periods or signs.


In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
December 02, 2010, 10:53 AM
swetha
I changed the read to
-READ HEAD &V9.A24.
This solved my problem.

Thanks.


WebFOCUS 7.6.7
windows
Html,Pdf and Excel