Although CA Culprit does not support real and double precision as REC parameter data types, there is a simple coding technique to work around the deficiency.
CA Culprit will treat real SQL columns as four byte alphanumeric fields. Double precision columns will be treated as eight byte alphanumeric fields. 16 byte packed decimal work fields can be defined, and CULLUS36 can be used to convert the floating point values to packed decimal. The CA Culprit program below illustrates the technique.
Converting to Packed Decimal
col. 2
▼
IN DB(Q) DICTIONARY=TSTDICT SCHEMA=INV
SQL SELECT * FROM FLOAT_TABLE;
$ CA Culprit will generate the REC cards shown below.
$REC REAL_DATA 49 4 $ GENERATED
$REC DOUBLE_DATA 53 8 $ GENERATED
$
010 WK_REAL 0.000000
010 WK_DOUBLE 0.000000000000
010 RETCODE ' '
0151*001 WK_REAL HF
0151*002 WK_DOUBLE HF
017 CALL US36(REAL_DATA, 'S', WK_REAL, 6, RETCODE)
017 IF RETCODE NE ' ' 200
017 CALL US36(DOUBLE_DATA, 'D', WK_DOUBLE, 12, RETCODE)
017 IF RETCODE NE ' ' 200
017 TAKE
017200 CALL US48(' ERROR IN FLOATING POINT CONVERSION%%')
017 DROP
The arguments for CULLUS36 are described below:
US36 Arguments(Error: Don't know what to do with column width of "20," (3).
Name of input field containing the floating point value
'S' = Single Precision:
'D' = Double Precision
Name of 16 byte packed decimal work field
Integer indicating number of decimal places in result field
Name of four byte alpha work field
|
Copyright © 2014 CA.
All rights reserved.
|
|