Focal Point
Reading Packed Decimal from Hold File

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

April 04, 2006, 12:17 PM
smiths
Reading Packed Decimal from Hold File
What is the syntax to read fields from a hold file consisting of format P15.2?

I have code like this

DEFINE FILE XX
D_HLDBK_AMT /P15.2M = HDBK_AMT;
D_ADVNC /P15.2M = CLM_ADV_AMT;
END

TABLE FILE XX
SUM
D_HLDBK_AMT
D_ADVNC
WHERE STAT NE 'CN'
ON TABLE HOLD AS HTOTAL FORMAT FOCUS
END

-RUN

-READ &T_HLDBK_AMT.P15 &T_ADVNC.P15

-TYPE T_HLDBK_AMT (&T_HLDBK_AMT)
-TYPE T_ADVNC (&T_ADVNC)

I am getting the error
(FOC295) A VALUE IS MISSING FOR: T_HLDBK_AMT

I can't for the life of me figure out the correct syntax....do I need FORMAT FOCUS, or something else?

Should the -READ use format P15 or something else? Are other commas or decimals required in the -READ line??

Your assistance is appreciated!!

Thanks,
Sean


------------------------------------------------------------------------
PROD: WebFOCUS 7.6.2 on Unix AIX/Tomcat/Servlet Mode
TEST: WebFOCUS 7.6.2 on Unix AIX/Tomcat/Servlet Mode
April 04, 2006, 12:35 PM
Leah
When you hold as format focus or most any thing else you can just use a TABLE FILE against the hold as name.

To be honest, I've never used the -read command.


Leah
April 04, 2006, 01:07 PM
reFOCUSing
I don't know if holding as ALPHA is an option but you can give this a try:

DEFINE FILE CAR
TEST/P15.2 = DEALER_COST;
END
-RUN
TABLE FILE CAR
SUM
     DEALER_COST
     TEST
ON TABLE HOLD AS H0 FORMAT ALPHA
END
-RUN
? HOLD H0
-RUN
-READ H0 &COST.D7 &TEST.P15.2
-RUN
-TYPE COST: &COST
-TYPE TEST: &TEST
-RUN

April 04, 2006, 01:12 PM
<JG>
You can not -READ a format FOCUS file as they are binary.

Change to code to use SAVE AS HTOTAL and it will work

DEFINE FILE XX
D_HLDBK_AMT /P15.2M = HDBK_AMT;
D_ADVNC /P15.2M = CLM_ADV_AMT;
END

TABLE FILE XX
SUM
D_HLDBK_AMT
D_ADVNC
WHERE STAT NE 'CN'
ON TABLE SAVE AS HTOTAL
END

-RUN

-READ &T_HLDBK_AMT.A15. &T_ADVNC.A15.

-TYPE T_HLDBK_AMT (&T_HLDBK_AMT)
-TYPE T_ADVNC (&T_ADVNC)
April 04, 2006, 01:28 PM
smiths
JG, thanks a bunch!! That worked great! It has always been a mystery to me.

Thanks reFOCUSing and Leah for your help also!

Sean


------------------------------------------------------------------------
PROD: WebFOCUS 7.6.2 on Unix AIX/Tomcat/Servlet Mode
TEST: WebFOCUS 7.6.2 on Unix AIX/Tomcat/Servlet Mode