Initializing or moving values to COMP-5 fields

Hello folks,

I am dealing with quite a lot of fields in the CALL "PC_PRINTER_DEFAULT_FONT" and in the CALL "PC_PRINT_FILE" but I have never worked 

with COMP-5 format. Would please send a couple of examples or explanations to me. I did not succeed in the first seaches throgh the Internet.

Thanks a lot, in advance,

Cheers.

Rui Natal  

  • COMP-5 fields are used to represent either signed or unsigned integer data stored as binary fields in the byte order of the computer on which the program is running.

    The picture for a COMP-5 field can contain either 9's or X's.

    In the case of 9's each 9 represents a decimal digit into which the value can be placed.

    In the case of X's each X represents a single byte of storage so a PIC X(2) COMP-5 field represents a 16-bit fields while a PIC X(4) COMP-5 represents a 32-bit field.

    You can move numeric values to a COMP-5 field in the same manner as other numeric fields which define an integer.

    01 field1     pic 9(9) comp-5.       *> internally the same as pic x(4) or 32-bits.
    01 field2     pic x(4) comp-5.

      move 500 to field1
      move 9999 to field2

    For more information on the storage of fields including COMP-5, please see the Visual COBOL Documentation here:

    Thanks.