Starting with Enterprise COBOL V5 and upwards, the compiler version can be found from a section named 'Timestamp and Version Information' below.
(Compile a COBOL code with 'LIST' to view this information)
https://www.ibm.com/support/knowledgecenter/en/SS6SG3_6.2.0/com.ibm.cobol62.ent.doc/PGandLR/ref/rpbugppa.html
897 Timestamp and Version Information
898 000CD0 F2F0 F1F8 =C'2018' Compiled Year
899 000CD4 F1F1 F2F2 =C'1122' Compiled Date MMDD
900 000CD8 F1F6 F3F1 F4F7 =C'163147' Compiled Time HHMMSS
901 000CDE F0F6 F0F2 F0F0 =C'060200' VERSION/RELEASE/MOD LEVEL OF PROD
LINE.901 means COBOL 6.2.0. The location can be calculated at runtime by 1) Find PPA1 2) Find PPA2 3) Find 'TIMESTMP-PPA2'
For example, LINE137 is the entry point of a program 'X1'. Note, LINE141, 550, and 671 which leads to the 'TIMESTMP' section.
137 000000 000002 PROC X1
138 000000 47F0 F014 000002 BC R15,20(,R15) # Skip over constant area
139 000004 01C3 C5C5 000002 DC X'01C3C5C5' # Eyecatcher: CEE
140 000008 0000 0168 000002 DC X'00000168' # Stack Size
141 00000C 0000 05C8 000002 DC X'000005C8' # Offset to PPA1
547 PPA1: Entry Point Constants
548 1PP 5655-EC6 IBM Enterprise COBOL for z/OS 6.2.0 P181122 X1 Date 11/27/2018 Time 11:46:07 Page 14
549 0 0005C8 1CCEA506 =F'483304710' Flags
550 0005CC 00000788 =A(PPA2-X1)
551 0005D0 000006F8 =A(PPA3-X1)
552 0005D4 00000000 =F'0' No EPD
667 0 PPA2: Entry Point Constants
668 000788 04002203 =F'67117571' Flags
669 00078C FFFFF878 =A(CEESTART-PPA2)
670 000790 00000058 =F'88' A(PPA4-PPA2)
671 000794 FFFFFFB0 =A(TIMESTMP-PPA2)
672 000798 FFFFF878 =A(PrimaryEntryPoint-PPA2)
673 00079C 02000000 =F'33554432' Flags
The layout of PPA1/PPA2 can be found from z/OS Language Env Vendor interface
https://www.ibm.com/support/knowledgecenter/en/SSLTBW_2.1.0/com.ibm.zos.v2r1.ceev100/rtnlyout.htm
This is also the same idea
https://www.ibm.com/support/knowledgecenter/en/SS6SG3_6.2.0/com.ibm.cobol62.ent.doc/migrate/igymapxd025.html
This is simpler. Note the member ID 04 is for COBOL 5 and 6.
https://www.ibm.com/support/knowledgecenter/en/SSLTBW_2.3.0/com.ibm.zos.v2r3.ceev100/cee1v223.htm
The Member Identifier (PPA2 offset X'00') identifies the product origin of the running code by compiler. Language Environment-enabled language member identifiers show the codes for the various compiler products. The product codes are assigned by IBM® and the assignment codes are in decimal. The member list table's implementation size is bound to a maximum of 17 (0 through 16) for Language Environment.
Figure 1. Language Environment-enabled language member identifiers
00 Reserved
01 Language Environment (CEL)
02 Reserved
03 OS/390 C/C++, C VM/ESA, XL C/C++
04 COBOL V5
05 COBOL for OS/390 & VM, COBOL for MVS & VM
06 z/OS Debugger
07 VS FORTRAN
08 Reserved
09 Available
10 PL/I for MVS & VM
11 VisualAge PL/I for OS/390
12 Berkeley Sockets
13 Available
14 Reserved
15 ASSEMBLER
16 Reserved
Roy Bae