I am using GNU COBOL 3.2.1 on Windows 10 and I use the switch -std=mvs-strict.
My main requirement is to be able to compile the code for batch processing and run it on Windows 10 and IBM Z/OS Enterprise COOBL. I selected-std=mvs-strict hoping this would satisfy this requirement. I am open for other compilation flags/switches that would satisfy the purpose.
Issue #1 The code: EXIT PARAGRAPH results in an error message: syntax error, unexpected Identifier.
If I remove -std=mvs-strict it compiles fine.
I want my code to be compatible with latest Z/OS COBOL compiler and still use EXIT PARAGRAPH.
Issue #2 Another problem I have with this compiler option is when using functions like TRIM.
The compiler does not like the code:
REPOSITORY. FUNCTION ALL INTRINSIC. under -std=mvs-strict
And if take the above line out. I get the compiler message:
error: FUNCTION 'TRIM' unknown
Even when I explicitly use the FUNCTION word for example:
MOVE FUNCTION TRIM(...) TO ...
What can I do? Thanks.
Note: The code compiles with:
cobc.exe A.cbl -free -std=cobol2014 -x -o A.EXE
cobc.exe A.cbl -free -x -o A.EXE
However, I am sure that COBOL 2014 is not like MVS, for example COBOL 2014 does not like RETRUN-CODE, not sure about the other differences for batch processing.
Note: this question was asked on STACKOVERFLOW few days ago with no answer.
With a >>SOURCE FREE line at front it compiles & runs fine on GnuCOBOL 4.0x - Displays an 'A' not ' A' and exits program - no errors - using default.conf however.
Last edit: David Wall 2021-08-15
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
Anonymous
-
2021-08-15
It compiles without -std. Did it compile with -std=mvs-string using version 4?
Thank you.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
According to mvs.words (in /config) the function TRIM is not present - It is specifically present in cobol2002 & cobol2014 & I have it in default.conf but it doesn't appear anywhere else.
I've just listed to file the mvs-strict allowed words for system, reserved, mnemonics & intrinsics, check page 2 of the gnucobol manual - these 'can' be listed (well in my case they can since I've just rebuilt a 3.2.1 GnuCOBOL from source.
In your case - where did you get the 3.2.1 from ??.
Thank you for this finding. I am surprised.
I checked my version and it is 3.1.2.0 not 3.2 as I was thinking.
As for the source I downloaded the compiler from, well it was a web site that offered a setup.exe but I am not able to locate the url!
What do you suggest I use today to make the source compatible with the "current" Z/OS (COBOL 6.1?)?
I highlighted & copy/pasted the source off the screen - it 'appeared' to be free format as some seemed to be in col 1 yet other lines were indented - I edited it my end to put it all in col1 & added the free format line. I wasn't trying to intimate that anyone was wrong anywhere.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
David, there must be confusion regarding as to what is acceptable COBOL for a zOS application.
Vendors other than IBM have taken the liberty of tainting COBOL.
With zOS COBOL there is no such COBOL support for a SCREEN SECTION.
"C" data declarations under the guise of Type Defs are not to be found in zOS COBOL (ILE AS/400 COBOL is an exception), Repository, GUI COBOL in general are foreign to real COBOL.
Some of the vitiated "improvements" are necessary to support COBOL on platforms other than zOS / VSE.
Other obfuscations are an attempt to create a hybrid "C" COBOL - Why ?
Adding to the confusion is COBOL-IT like support presented via zOS USS.
For those attempting to make the journey from COBOL hobbyist to a zOS professional COBOL programmer it has to be frustrating.
"zOS runs the economy of the world" (Credit the IBM ISPF / TSO logon screen below)
Ralph, The 'first time' I programmed in COBOL was back in 1968 - I think I've still got a manual for Honeywell H200 dated about then. I know back in 69 I actually had a 1/2" tape from USA with software source from US Navy that had Grace Hopper' name as author. All this end-display end-if stuff is rather foreign to me - I'm more familiar with goto & alter xxx to proceed to yyy than more modern stuff.
As I said before - I use the default.conf - I've no understanding of the various 'flavours'.
All the best.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
Anonymous
-
2021-08-15
The zOS COBOL CICS preprocessor, SQL preprocessor, DL/I preprocessor, Xpeditor, and many other COBOL products need to be rewritten to accommodate free form COBOL. If I were designing and implementing programs for zOS execution I would only use pure COBOL not some hybrid version. There are many supposed improvements to vendor incarnations of pure COBOL all are worthless in a zOS setting
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Back to the other part of the original question:
EXIT PARAGRAPH is not accepted when using -std=mvs-strict
But Enterprise COBOL for z/OS 6.3 Programmer's Guide mentions it as valid.
Maybe -std=mvs-strict does not address Z/OS COBOL, only MVS COBOL prior Z/OS.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Please create a bug report for this omission but make sure you reference
the compiler version.
On 16/08/2021 13:43, Emmad wrote:
Back to the other part of the original question:
EXIT PARAGRAPH is not accepted when using -std=mvs-strict
But Enterprise COBOL for z/OS 6.3 Programmer's Guide mentions it as valid.
Maybe -std=mvs-strict does not address Z/OS COBOL, only MVS COBOL
prior Z/OS.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If you open the 'res' file (reserved words) I uploaded earlier on in this discussion you will find the word 'paragraph' does not exist as a reserved word in the mvs dialect - whereas it does in all the others - acu, bs2000, cobol2002, cobol2014, cobol85, ibm, mf, realia & rm & default.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am using GNU COBOL 3.2.1 on Windows 10 and I use the switch
-std=mvs-strict.My main requirement is to be able to compile the code for batch processing and run it on Windows 10 and IBM Z/OS Enterprise COOBL. I selected
-std=mvs-stricthoping this would satisfy this requirement. I am open for other compilation flags/switches that would satisfy the purpose.Issue #1 The code:
EXIT PARAGRAPHresults in an error message: syntax error, unexpected Identifier.If I remove
-std=mvs-strictit compiles fine.I want my code to be compatible with latest Z/OS COBOL compiler and still use
EXIT PARAGRAPH.Issue #2 Another problem I have with this compiler option is when using functions like TRIM.
The compiler does not like the code:
REPOSITORY. FUNCTION ALL INTRINSIC.under-std=mvs-strictAnd if take the above line out. I get the compiler message:
error: FUNCTION 'TRIM' unknown
Even when I explicitly use the FUNCTION word for example:
MOVE FUNCTION TRIM(...) TO ...What can I do? Thanks.
Note: The code compiles with:
cobc.exe A.cbl -free -std=cobol2014 -x -o A.EXEHowever, I am sure that COBOL 2014 is not like MVS, for example COBOL 2014 does not like RETRUN-CODE, not sure about the other differences for batch processing.
Note: this question was asked on STACKOVERFLOW few days ago with no answer.
Code Example~~~
IDENTIFICATION DIVISION.
PROGRAM-ID. BASE1.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
> SOURCE COMPUTER.
> OBJECT COMPUTER.
SPECIAL-NAMES.
~~~
Compilation from command line results:
D:\RR-TESTS\x>cobc.exe C.cbl -free -std=mvs-strict -x -o C.EXE
C.cbl:9: error: invalid system-name 'REPOSITORY'
C.cbl:9: error: syntax error, unexpected ., expecting CRT or Identifier
C.cbl:9: error: syntax error, unexpected intrinsic function name
C.cbl:9: error: invalid system-name 'INTRINSIC'
C.cbl:11: error: syntax error, unexpected INPUT-OUTPUT
C.cbl:12: error: INPUT-OUTPUT SECTION header missing
C.cbl: in paragraph 'P10':
C.cbl:22: error: FUNCTION 'TRIM' unknown
Last edit: Emmad 2021-08-15
Maybe if you can provide a minimal example of the program with the code that causes the error.
Did as you suggested. Thanks.
With a >>SOURCE FREE line at front it compiles & runs fine on GnuCOBOL 4.0x - Displays an 'A' not ' A' and exits program - no errors - using default.conf however.
Last edit: David Wall 2021-08-15
It compiles without -std. Did it compile with -std=mvs-string using version 4?
Thank you.
No - you're right - the following errors :
test.cob:7: error: invalid system-name 'REPOSITORY'
test.cob:7: error: syntax error, unexpected ., expecting CRT or Identifier
test.cob:7: error: syntax error, unexpected intrinsic function name
test.cob:7: error: invalid system-name 'INTRINSIC'
test.cob:9: error: syntax error, unexpected INPUT-OUTPUT
test.cob:10: error: INPUT-OUTPUT SECTION header missing
test.cob: in paragraph 'P10':
test.cob:20: error: FUNCTION 'TRIM' unknown
Identical to yours - sorry.
According to mvs.words (in /config) the function TRIM is not present - It is specifically present in cobol2002 & cobol2014 & I have it in default.conf but it doesn't appear anywhere else.
I've just listed to file the mvs-strict allowed words for system, reserved, mnemonics & intrinsics, check page 2 of the gnucobol manual - these 'can' be listed (well in my case they can since I've just rebuilt a 3.2.1 GnuCOBOL from source.
In your case - where did you get the 3.2.1 from ??.
Last edit: David Wall 2021-08-15
Thank you for this finding. I am surprised.
I checked my version and it is 3.1.2.0 not 3.2 as I was thinking.
As for the source I downloaded the compiler from, well it was a web site that offered a setup.exe but I am not able to locate the url!
What do you suggest I use today to make the source compatible with the "current" Z/OS (COBOL 6.1?)?
Thank you again.
EDIT 15-Aug-21
Beginning with Enterprise COBOL Version 3 (Z/OS COBOL 6.3), the TRIM function is supported. Reference:
https://www.ibm.com/docs/en/cobol-zos/6.3?topic=appendixes-20022014-cobol-standard-features-implemented-in-enterprise-cobol-version-3-later-versions
Last edit: Emmad 2021-08-15
Does zOS 6.1 support free format COBOL ?
I do not see it as an option ?
https://www.ibm.com/docs/en/cobol-zos/6.1?topic=program-compiler-options
Last edit: Ralph Linkletter 2021-08-15
You are correct. I know it has been part of COBOL 2002 but I have no evidence that is supported. I am surprised!!
Edit on 16 Aug 21 - The requirement got turned down on 2020 - Read more here if you wish:
https://stackoverflow.com/questions/68795475/does-enterprise-cobol-support-free-format-source-code
Last edit: Emmad 2021-08-16
I highlighted & copy/pasted the source off the screen - it 'appeared' to be free format as some seemed to be in col 1 yet other lines were indented - I edited it my end to put it all in col1 & added the free format line. I wasn't trying to intimate that anyone was wrong anywhere.
David, there must be confusion regarding as to what is acceptable COBOL for a zOS application.
Vendors other than IBM have taken the liberty of tainting COBOL.
With zOS COBOL there is no such COBOL support for a SCREEN SECTION.
"C" data declarations under the guise of Type Defs are not to be found in zOS COBOL (ILE AS/400 COBOL is an exception), Repository, GUI COBOL in general are foreign to real COBOL.
Some of the vitiated "improvements" are necessary to support COBOL on platforms other than zOS / VSE.
Other obfuscations are an attempt to create a hybrid "C" COBOL - Why ?
Adding to the confusion is COBOL-IT like support presented via zOS USS.
For those attempting to make the journey from COBOL hobbyist to a zOS professional COBOL programmer it has to be frustrating.
"zOS runs the economy of the world" (Credit the IBM ISPF / TSO logon screen below)
Last edit: Ralph Linkletter 2021-08-16
Ralph, The 'first time' I programmed in COBOL was back in 1968 - I think I've still got a manual for Honeywell H200 dated about then. I know back in 69 I actually had a 1/2" tape from USA with software source from US Navy that had Grace Hopper' name as author. All this end-display end-if stuff is rather foreign to me - I'm more familiar with goto & alter xxx to proceed to yyy than more modern stuff.
As I said before - I use the default.conf - I've no understanding of the various 'flavours'.
All the best.
Thanks for you help.
The zOS COBOL CICS preprocessor, SQL preprocessor, DL/I preprocessor, Xpeditor, and many other COBOL products need to be rewritten to accommodate free form COBOL. If I were designing and implementing programs for zOS execution I would only use pure COBOL not some hybrid version. There are many supposed improvements to vendor incarnations of pure COBOL all are worthless in a zOS setting
Back to the other part of the original question:
EXIT PARAGRAPH is not accepted when using -std=mvs-strict
But Enterprise COBOL for z/OS 6.3 Programmer's Guide mentions it as valid.
Maybe -std=mvs-strict does not address Z/OS COBOL, only MVS COBOL prior Z/OS.
Please create a bug report for this omission but make sure you reference
the compiler version.
On 16/08/2021 13:43, Emmad wrote:
Done - Thanks.
https://sourceforge.net/p/gnucobol/bugs/752/
Yes, for Enterprise COBOL use -std=ibm-strict.
Thank you.
If you open the 'res' file (reserved words) I uploaded earlier on in this discussion you will find the word 'paragraph' does not exist as a reserved word in the mvs dialect - whereas it does in all the others - acu, bs2000, cobol2002, cobol2014, cobol85, ibm, mf, realia & rm & default.
Maybe the list needs to clarify the IBM version in more details.
Last edit: Emmad 2021-08-16