Focal Point
[SOLVED] How to read packDecimal value from a SAVE file on mainframe

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

August 19, 2009, 05:14 PM
Emily Lee
[SOLVED] How to read packDecimal value from a SAVE file on mainframe
I like to know how to READ the PackDecimal value from a SAVE file with server 7.6.7 on Mainframe. The code works for 7.1.4 fails on 7.6.7

I need to read three data value from a query result.
DB2 table is defined as

FIELD=WRKDAYS ,WRKDAYS ,I6 ,I2 ,MISSING=OFF,
FIELD=PAID_HRS ,PAID_HRS ,P13.2 ,P6 ,MISSING=OFF,
FIELD=DELD_CASE_CNT ,DELD_CASE_CNT ,I9 ,I4 ,MISSING=OFF,


My Program is

TABLE FILE FPADRO
PRINT WRKDAYS DELD_CASE_CNT PAID_HRS
WHERE so AND so AND so
ON TABLE SAVE AS DAYS
END
-RUN

-READ DAYS &WKDAYS.I6. &DELCASE.I9. &PDHRS.P13.

this program ran well with server 7.1.6 but now it fails with server 7.6.7 with the following error message


0 ERROR AT OR NEAR LINE 31 IN PROCEDURE ROWAICL0FOCEXEC *
(FOC299) UNRECOGNIZED FORMAT OF AMPER VARIABLE IN -READ: -READ DAYS &WKDAYS.I6.
&DELCASE.I9. &PDHRS.P13.

thanks,
EL from Baltimore

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


WebFOCUS 8.2.01 AppStudio
HTML, PDF, Excel
August 19, 2009, 05:18 PM
GinnyJakes
Try doing ON TABLE HOLD FORMAT ALPHA instead. When you create the save file, can you post the formats it gives you for the fields? On your -READ, you might want to change the P13 to an A13.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
August 20, 2009, 12:54 AM
<JG>
SAVE always creates an ALPHA format file.
If you want a binary save file you must use SAVB.

However the issue here is code tightening.

& variables are always alpha and should be read (in your case) as

-READ DAYS &WKDAYS.A6. &DELCASE.A9. &PDHRS.A13.

The fact that -READ worked wrongly in the past is unfortunate,
and I know there are a lot of people out there who are going to have the same issue
August 20, 2009, 02:49 AM
GamP
To avoid any possible misunderstandings in any situation, I always use (and used) the -READ without any format indications, only lengths. My code would have read:
-READ DAYS &WKDAYS.6. &DELCASE.9. &PDHRS.13.
which is accepted in all previous releases of (Web)Focus, as well as the latetst one.


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
August 20, 2009, 07:21 AM
Danny-SRL
You can also use the variable field length format of -READ:
  
DEFINE FILE FPADRO
COMMA/A1=',';
END
TABLE FILE FPADRO
PRINT WRKDAYS COMMA DELD_CASE_CNT COMMA PAID_HRS
WHERE so AND so AND so 
ON TABLE SAVE AS DAYS
END
-RUN

-READ DAYS,&WKDAYS,&DELCASE,&PDHRS

Like that, if ever your MASTER is changed because the underlying DB2 table is changed, it will still work.


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

August 20, 2009, 08:12 AM
jimster06
If I recall correctl;y, amper vars are strings, either character or integers. You may want to rethink how you handle the packed decimal field.
HTH


jimster06
DevStu WF 7.6.11
W7
HTML, PDF, EXL2K
August 21, 2009, 02:23 PM
Emily Lee
Thank you very much for good suggestions from many of you. We learn a lot.

Emily


WebFOCUS 8.2.01 AppStudio
HTML, PDF, Excel