SAS® formats that correspond to COBOL data descriptions


Many formats are available in Base SAS® for writing out values that can be read by COBOL applications. A COBOL PICTURE clause is used for data description. The PICTURE and USAGE are used to determine the data type and the width of the value.

Use the following table to determine which SAS format to use when writing out values that need to correspond to COBOL data descriptions.

TYPE                     SAS FORMAT         COBOL PICTURE
-----------------------  ---------------    ---------------------------
Character                $w., $CHARw. or    PIC X(n)
                         $EBCDICw.

Numeric                  w.d or S370FF      PIC 9(int)V9(fract)

Unsigned Packed Decimal  PK or S370FPDU     PIC 9(int)V9(fract) COMP-3

Packed Decimal           PD or S370FPD      PIC S9(int)V9(fract) COMP-3

Unsigned Zoned Decimal   S370FZDU           PIC 9(int)V9(fract) DISPLAY

Zoned Decimal            ZD or S370FZD      PIC S9(int)V9(fract) DISPLAY

Zoned Decimal Leading    S370FZDL           PIC S9(int)V9(fract) DISPLAY
 Sign                                        SIGN LEADING

Zoned Decimal Leading    S370FZDS           PIC S9(int)V9(fract) DISPLAY
 Sign Separate                               SIGN LEADING SEPARATE

Zoned Decimal Trailing   S370FZDT           PIC S9(int)V9(fract) DISPLAY
 Sign Separate                               SIGN TRAILING SEPARATE

Unsigned Integer Binary  S370FIBU           PIC 9(int)V9(fract) COMP

Integer/Positive         IB, PIB, S370FIB   PIC S9(int)V9(fract) COMP
 Integer Binary          or S370FPIB

Real Binary              RB4. or S370FRB4.  no picture but usage COMP-1

Real Binary              RB8. or S370FRB8.  no picture but usage COMP-2


Use the following chart to determine the correct width and decimal specification to use with the SAS format.

   USAGE                       WIDTH                     DECIMAL
   -----                       -----                     -------

   DISPLAY (Zoned Decimal)     (int+fract)               (fract)

   COMP-3 (Packed Decimal)     CEIL((int+fract+1)/2)     (fract)

   COMP (Integer Binary):

    if  1<=(int+fract)<=4      2                         (fract)
    if  5<=(int+fract)<=9      4                         (fract)
    if 10<=(int+fract)<=18     8                         (fract)

Please reference SAS Note 56654, "SAS® informats that correspond to COBOL data descriptions", for further information about COBOL picture clauses and corresponding SAS informats.