Saving Report Output in INTERNAL Format

How to:

Reference:

HOLD files pad binary integer and packed decimal data values to a full word boundary. For example, a three-digit integer field (I3), is stored as four bytes in a HOLD file. In order for third generation programs, such as COBOL, to be able to read HOLD files in an exact manner, you may need to save the fields in the HOLD file without any padding.

To suppress field padding in the HOLD file, you must reformat the fields in the request in order to override the default ACTUAL formats that correspond to the USAGE formats in the Master File:

Syntax: How to Suppress Field Padding in HOLD Files

SET HOLDLIST = PRINTONLY
TABLE FILE filename 
display_command fieldname/[In|Pn.d]
.
.
ON TABLE HOLD AS name FORMAT INTERNAL
END

where:

PRINTONLY
Causes your report request to propagate the HOLD file with only the specified fields displaying in the report output. If you do not issue this setting, an extra field containing the padded field length is included in the HOLD file. See Controlling Fields in a HOLD Master File.
fieldname/[In|Pn.d]
Specify correct lengths in the formats for integer and packed fields where you wish to suppress padding. These formats override the ACTUAL formats used for the display formats in the Master File. See Usage Notes for Suppressing Padded Fields in HOLD Files.

Note that floating point double-precision (D) and floating point single-precision (F) are not affected by HOLD FORMAT INTERNAL.

FORMAT INTERNAL
Saves the HOLD file without padding for specified integer and packed decimal fields.

Reference: Usage Notes for Suppressing Padded Fields in HOLD Files

  • Integer fields (I) of one, two, three, or four bytes produce four-byte integers without HOLD FORMAT INTERNAL.
  • For packed decimal fields (Pn.d), n is the total number of digits and d is the number of digits to the right of the decimal point. The number of bytes is derived by dividing n by 2 and adding 1.

    The syntax is

    bytes = INT (n/2) + 1

    where:

    INT (n/2)
    Is the greatest integer after dividing by 2.
  • HOLD FORMAT INTERNAL does not affect floating point double-precision (D) and floating point single-precision (F) fields. D remains at eight bytes, and F at four bytes.
  • Alphanumeric fields automatically inherit their length from their source Master File, and are not padded to a full word boundary.
  • If a format override is not large enough to contain the data values, the values are truncated. Truncation may cause the data in the HOLD file to be incorrect in the case of an integer. For packed data and integers, truncation occurs for the high order digits so the remaining low order digits resemble the digits from the correct values.

    To avoid incorrect results, be sure that the format you specify is large enough to contain the data values.

  • If you use the HOLDMISS=ON setting to propagate missing values to the HOLD file, short packed fields and fields with formats I1, I2, and I3 are not large enough to hold the missing value.

Example: Creating a HOLD File Without HOLD FORMAT INTERNAL

In this example, the values of ACTUAL for RETAIL_COST, DEALER_COST, and SEATS are all padded to a full word. Alphanumeric fields also occupy full words.

TABLE FILE CAR
PRINT CAR COUNTRY RETAIL_COST DEALER_COST SEATS
ON TABLE HOLD AS DJG
END

The request creates the following Master File:

FILE=DJG, SUFFIX=FIX
 SEGMENT=DJG, SEGTYPE=S0
  FIELDNAME=CAR          ,ALIAS=E01  ,USAGE=A16  ,ACTUAL=A16    ,$
  FIELDNAME=COUNTRY      ,ALIAS=E02  ,USAGE=A10  ,ACTUAL=A12    ,$
  FIELDNAME=RETAIL_COST  ,ALIAS=E03  ,USAGE=D7   ,ACTUAL=D08    ,$
  FIELDNAME=DEALER_COST  ,ALIAS=E04  ,USAGE=D7   ,ACTUAL=D08    ,$
  FIELDNAME=SEATS        ,ALIAS=E05  ,USAGE=I3   ,ACTUAL=I04    ,$

Example: Creating a HOLD File With HOLD FORMAT INTERNAL

In this example, DEALER_COST and RETAIL_COST are defined in the Master File as D fields, but the request overrides RETAIL_COST as an I2 field and DEALER_COST as a P3 field.

SET HOLDLIST=PRINTONLY
TABLE FILE CAR
PRINT CAR COUNTRY RETAIL_COST/I2 DEALER_COST/P3 SEATS/I1
ON TABLE HOLD AS HINT3 FORMAT INTERNAL
END

This creates the following Master File:

FILE=HINT3, SUFFIX=FIX
 SEGMENT=HINT3, SEGTYPE=S0
  FIELDNAME=CAR          ,ALIAS=E01   ,USAGE=A16  ,ACTUAL=A16   ,$
  FIELDNAME=COUNTRY      ,ALIAS=E02   ,USAGE=A10  ,ACTUAL=A10   ,$
  FIELDNAME=RETAIL_COST  ,ALIAS=E03   ,USAGE=I6   ,ACTUAL=I02   ,$
  FIELDNAME=DEALER_COST  ,ALIAS=E04   ,USAGE=P4   ,ACTUAL=P02   ,$
  FIELDNAME=SEATS        ,ALIAS=E05   ,USAGE=I4   ,ACTUAL=I01   ,$

The ACTUAL formats for the overridden fields are I2, P2, and I1. DEALER_COST has an ACTUAL of P2 because P3, the format override, means 3 display digits that can be stored in 2 actual digits. Note that the alphanumeric field is also not padded.