Hi,
in the pc environment, the comp-5 field is supported.
It is in fact an Intel compatible format.
In storage it is completely different build than the traditional
COMP-4 format, see the example here which gives the same result
using the CA-REALIA COBOL compiler as well as the Micro Focus
COBOL compiler.
Is this format supported by the newest MVS COBOL 390 compiler from
IBM and if so, does it have the same internal format as
demonstrated here?
That means that a comp-4 redefined string with value 'ABCDEFGH'
after a numeric move to a comp-5 field has the value 'HGFEDCBA'.
Does anyone know if the results on the PC are the same as on
the mainframe?
Does the visual age environment on the PC gives the same results?
Thank you very much in advance!
000100 IDENTIFICATION DIVISION.
................
001700 DATA DIVISION.
001800 WORKING-STORAGE SECTION.
002100 01 HULPVELDEN.
002102 03 FULL-WORD PIC X(8) VALUE 'ABCDEFGH'.
002110 03 COMP-4-DEFINITIE REDEFINES FULL-WORD
002111 PIC S9(18) COMP-4.
002130 03 COMP-5-DEFINITIE REDEFINES FULL-WORD
002140 PIC S9(18) COMP-5.
002150 03 DISP-18-CIJFERS PIC -9(18).
003600 LINKAGE SECTION.
003700 PROCEDURE DIVISION.
003800 MAIN SECTION.
003900 MAI-00.
004000 DISPLAY '*** OI812V01 START ***'.
004100 DISPLAY 'DEMO BETEKENIS COMP-5 IN COBOL'.
004110 MOVE COMP-4-DEFINITIE TO DISP-18-CIJFERS.
004200 DISPLAY 'COMP-4-DEFINITIE = ' DISP-18-CIJFERS.
004300 MOVE COMP-5-DEFINITIE TO DISP-18-CIJFERS.
004400 DISPLAY 'COMP-5-DEFINITIE = ' DISP-18-CIJFERS.
004500 DISPLAY 'MOVE COMP-4 NAAR COMP-5'.
004600 MOVE COMP-4-DEFINITIE TO COMP-5-DEFINITIE.
004700 DISPLAY 'FULL-WORD = ' FULL-WORD.
004800 MOVE COMP-4-DEFINITIE TO DISP-18-CIJFERS.
004900 DISPLAY 'COMP-4-DEFINITIE = ' DISP-18-CIJFERS.
005000 MOVE COMP-5-DEFINITIE TO DISP-18-CIJFERS.
005100 DISPLAY 'COMP-5-DEFINITIE = ' DISP-18-CIJFERS.
005200 DISPLAY 'MOVE COMP-4 NAAR COMP-5'.
005300 MOVE COMP-4-DEFINITIE TO COMP-5-DEFINITIE.
011000 DISPLAY '*** OI812V01 EINDE ***'.
011100 MAI-99-EXIT.
011200 GOBACK.
output:
*** OI812V01 START ***
DEMO BETEKENIS COMP-5 IN COBOL
COMP-4-DEFINITIE = 702394921427289928
COMP-5-DEFINITIE = 208208757389214273
MOVE COMP-4 NAAR COMP-5
FULL-WORD = HGFEDCBA
COMP-4-DEFINITIE = 208208757389214273
COMP-5-DEFINITIE = 702394921427289928
MOVE COMP-4 NAAR COMP-5
*** OI812V01 EINDE ***