Thank you for posting this example.

This IMHO could not be derived from:

<citation>
Whereas in previous versions of ECOBOL a minimum and maximum record length
did not have to be specified when defining a variable file, v5.1 will return a file status of '04'
if any record is less than or greater than the minimum / maximum specified.
</citation>

because the behaviour depends on the record definitions
present in the FD and not on the RECORD CONTAINS clause,
which should have been mentioned.

Kind regards

Bernd



Am 03.04.2015 um 22:50 schrieb Greg Shirey:
The COBOL 5.1.1 Migration Guide contains an example of how to test for it. 
Compile this program 4.2 and message “Incompatible wrong length read behavior” 
will display.  (At least it did when I did it)





       *********************************************************

       ** **

       ** DESCRIPTION: This testcase tests if a compiler exhibits **

       ** corrected COBOL V5 var length READ behavior. **

       ** **

       *********************************************************

        IDENTIFICATION DIVISION.

        Program-id. READVAR.

        Environment division.

        Input-output section.

        File-control.

             Select File1

             Assign to ddvar1

             Access mode is sequential.

             Select File2

             Assign to ddvar1

             Access mode is sequential

             File status is fs2.

        I-O-control.

        Data division.

        File section.

        Fd file1

             Record is varying

             Recording mode V.

        01 Record1a pic x(20).

        01 Record1b pic x(40).

        Fd file2

             Record is varying 10 to 40

             Recording mode V.

        01 Record2a pic x(25).

        01 Record2b PIC x(35).

        Working-storage section.

        01 fs2 pic 99.

        01 fs3 pic 99.

        01 Errflag pic x value "N".

        Procedure division.

             Display "Starting READVAR".

       *--------------------------------------------------------

       * Create file1 with 1 20-byte record and 1 40-byte record

       *--------------------------------------------------------

             Open output file1

             Move all "a" to record1a

             Write record1a

             Move all "b" to record1b

             Write record1b

             Close file1.

       *--------------------------------------------------------

       * Read file2 with 25 and 35 byte records defined

       * First READ should get FS=4 because 20 byte record is

       * shorter than the smallest record description

       * Second READ should get FS=4 because 40 byte record is

       * longer than the longest record description

       *--------------------------------------------------------

             Open input file2

             Read file2

             If fs2 = 4 then

             Display " Corrected COBOL V5 behavior"

               Else

             Display " Incompatible wrong length read behavior"

             End-If

             Read file2

             If fs2 = 4 then

             Display " Corrected COBOL V5 behavior"

               Else

             Display " Incompatible wrong length read behavior"

             End-If

             Close file2.

             Goback.





HTH,

Greg Shirey

Ben E. Keith Company



-----Original Message-----

From: IBM Mainframe Discussion List [mailto:[email protected]] On Behalf 
Of Frank Swarbrick

Sent: Friday, April 03, 2015 1:50 PM

To: [email protected]

Subject: Re: migrating compiler versions



The RECORD CONTAINS clause is not required in either V4 or V5.  It (if not 
present) is determined from the smallest and largest 01 level fields in the 
FD.Both V4 and V5 give a compiler error if there is a RECORD CONTAINS clause 
that does not match what would have been assumed had it not been present.

I cannot figure out how to create a situation where COBOL V4 returns status 
'00' when there is a size mismatch.  I always get '04'.

Frank



----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN


--
Bernd Oppolzer
—————————————————————
*Oppolzer-Informatik
* Dipl. Inf. Bernd Oppolzer
Bärenhofstraße 23
70771 Leinfelden-Echterdingen
—————————————————————
Tel.: +49 711 7949591
priv.: +49 711 7949590
mobil: +49 151 75005359
eMail: [email protected] <mailto:[email protected]>
Web: http://bernd-oppolzer.de/job.htm
—————————————————————
Für Umsatzsteuerzwecke:
SteuerNr.: 97 076 / 29921
USt-ID-Nr.: DE 147 700 393
—————————————————————
Oppolzer-Informatik 1983 - 2015
0x20 years of experience in computer science


----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to