Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compile Cobol 4 with a Cobol 5 compiler

I need to compile Cobol sources, on z/OS UNIX, with a Cobol 4 compiler but I only have a Cobol 5 compiler. Is there options to restrict Cobol 5 to a Cobol 4 compilation ? I'm using the cob2 command which I mounted to the IGY520.HFS PDS of my Cobol installation on z/OS. I searched in the IBM documentation but didn't find anything.

like image 435
Timothée Avatar asked Jan 01 '23 10:01

Timothée


2 Answers

No. I strongly recommend you study the migration guide and any SHARE presentations on the topic of migration sadly SHARE no longer makes their excellent content available to non-members.

The most common problems reported have to do with invalid data tolerated by older compilers. Quoting from Tom Ross' SHARE presentation linked above...

77 A1 PIC X(4) VALUE ’00 0’.  *> x’F0F040F0’, third byte
                              *> has x’4’ for zone bits.
                              *> OK in PIC X, not valid in
                              *> PIC 9 USAGE DISPLAY

77 A2 REDEFINES A1 PIC 9(4).

PROCEDURE DIVISION.    
    IF A2 = ZERO              *> Compiler could do character
      DISPLAY ’ZERO‘          *> or numeric compare
    ELSE
      DISPLAY ’NOT ZERO‘
    END-IF

Whether the program displays ‘ZERO’ or ‘NOT ZERO’ depends on the compiler options you use in COBOL V4 and earlier and in COBOL V6

Also be aware of differences in how packed data is treated, see this recent question.

The NUMCHECK compile option can assist you in these situations, but be advised that compile options cannot detect invalid data at compile time, they can only generate code to detect invalid data at run time.

like image 67
cschneid Avatar answered Jan 09 '23 04:01

cschneid


Not that I am aware of. I see the following might be useful.

CMPR2, FLAGMIG, and NOCOMPILE compiler options

The COBOL CMPR2, FLAGMIG, and NOCOMPILE options identify source statements that need to be converted to compile under Enterprise COBOL. The CMPR2 and FLAGMIG options are not available in Enterprise COBOL, but you can use your older compilers with these options to flag the statements that need to be changed in order to compile with Enterprise COBOL.

Enterprise COBOL> V4.2 FLAGMIG4 compiler option

A new compiler option, FLAGMIG4, is available with APAR PM93450 for Enterprise COBOL V4.2 to help you migrate to Enterprise COBOL V5 or V6. It is also recommended that you install PTFs for APARs PI12240, PI26838, and PI58762 as these contain updates to the FLAGMIG4 option. The FLAGMIG4 option identifies language elements in Enterprise COBOL V4 programs that are not supported, or that are supported differently in Enterprise COBOL V5 or V6. The compiler generates a warning diagnostic message for all such language elements.

COBOL 6.2 Migration Guide

like image 22
Roy Avatar answered Jan 09 '23 04:01

Roy