Hi Prasanth:
Because of working with people who came to COBOL after using
Object Oriented languages, I think you need to be aware of the
following so that you correctly state problems:
COBOL is a procedural language. Programs compiled by a COBOL
compiler do not throw errors, ABENDs, protection exceptions, etc.
OO languages do this. Yes COBOL 6.x does have some OO support but
not like you may want.
Most of the programs that run in the z/OS environment are not
Object oriented, so they issue condition codes (CC) or Messages,
or they ABEND (ABnormal END).
Therefore, COBOL issues messages and gives Condition/return codes
or it ABENDs.
If you have the latest PTFs on your COBOL 4.2 (?) system, you can
turn on an option (if I remember this correctly) and it will flag
statements that will not be supported by COBOL 5(?) and later, or
will not be treated the same.
I have forgotten the option for this. But I think it is specified
in the COBOL 6.x Migration Guide.
So that may be of help as you migrate from 4 to 6.x.
In the case you have below, that option should have caught that.
But, the current COBOL compiler you are using detected the error
and flagged it.
Hope this helps you.
Steve Thompson
On 7/30/2024 9:03 AM, Prasanth S wrote:
Hi,
We are planning to switch from COBOL V4 to V6.4 in due time.
We have found that the INVDATA option of COBOL V6.4 mimics the V4 behaviour and
plan to use it when 6.4 compiled modules throw error when invalid data is
present.
One such test was to check the 0 length and negative length moves as in the
following:
DISPLAY 'Substrings with a length shorter than 1'
DISPLAY "Positive Lange"
MOVE +5 TO ZW-START
MOVE +4 TO ZW-LENGTH
DISPLAY ZW-TEXT(ZW-START:ZW-LENGTH)
DISPLAY "Lange Null"
MOVE +5 TO ZW-START
MOVE +0 TO ZW-LENGTH
DISPLAY ZW-TEXT(ZW-START:ZW-LENGTH)
DISPLAY "Negative Lange"
MOVE +5 TO ZW-START
MOVE -1 TO ZW-LENGTH
DISPLAY ZW-TEXT(ZW-START:ZW-LENGTH)
DISPLAY "The End"
STOP RUN.
This code ran ok when compiled with COBOL V4 but did not work well with COBOL
V6.4 with INVDATA option.
The error thrown was:
IGZ0073S A non-positive reference modification length value of 0 on line 000052
ZW-TEXT.
If any of you have already experienced this and have an explanation or a
solution, I would be grateful if you could share that.
Thanks in advance,
Best regards
Prasanth Sukumaran Nair
ITERGO Informationstechnologie GmbH
Development Tools and Application Security
Referent
Überseering 45
22297 Hamburg
Phone +49 40 6376-2402
[email protected]
Chairman of the Supervisory Board: Robin Johnson
Executive Management: Mario Krause (Chairman),
Michael Liebe, Tony Cameron McCarthy, Caroline Meister, Jens Parthe, Rui Valente
Registered Office: Düsseldorf, Commercial Register: District Court Düsseldorf,
HRB 37996
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN