gnucobol-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [open-cobol-list] Compiler modifications


From: Roger While
Subject: Re: [open-cobol-list] Compiler modifications
Date: Tue, 06 Jun 2006 10:44:08 +0200

The tarball at :
http://www.sim-basis.de/open-cobol-0.33.tar.gz
has (3) READ PREVIOUS, (5) [WITH] [NO] LOCK and
(6) UNLOCK filename [RECORD[S]] implemented/syntax accepted.
(5) and (6) produce a "not implemented" warning.
(3) is still experimental and is going through tests.
Here are some tests that have been done -
Short forms:
EOF = End-of-file
BOF = Beginning-of-file
FS = File-status
REC = Retrieved record
RN = READ NEXT
RP = READ PREVIOUS
OP = OPEN
CL = CLOSE
Take a file with two records - 1 and 2
It is assumed that OPEN/CLOSE are successful.
OP
RN   FS=00 REC=1
RN   FS=00 REC=2
RN   FS=10  (EOF)
RN   FS=46  (Read error)
CL
OP
RN   FS=00 REC=1
RN   FS=00 REC=2
RN   FS=10  (EOF)
RP   FS=00 REC=2
RP   FS=00 REC=1
RP   FS=10 (BOF)
RP   FS=46 (Read error)
CL
OP
RN   FS=00 REC=1
RN   FS=00 REC=2
RN   FS=10  (EOF)
RP   FS=00 REC=2
RP   FS=00 REC=1
RP   FS=10 (BOF)
RN   FS=00 REC=1
CL

(2) is WRONG. You can/MUST NOT get 2 consecutive
EOF (status 10) returns (on the same file).
Consider - A wrongly written program would
have a potential endless loop for the AT END
clause.
If your programs are relying on this behaviour
then you MUST recode them. They will also NOT
work on any other recent Cobol compiler.

This leaves (7)
As stated before, the rules are quite clear.
Fixed-format : Column 7 and that will/can NOT
be changed. Here, columns 1 to 6 are ignored.
Imagine we start looking for an asterisk in columns
1 to 6 - I have any number of ported apps that
(mis)use columns 1 to 6 for commenting/highlighting
code; INCLUDING an asterisk !

Free-format : Column 1 and column 1 only.
Consider these 3 lines (First character of each
line starts in column 3) -
  COMPUTE fld1 = fld2
  * fld3
  END-COMPUTE.
If we slide line 2 to the left so that the
asterisk begins in column 1, it becomes
a comment   :-)
(And still is valid code)

Roger

Roger,

Thanks for your comments; thanks Bill also. I am not at all an expert in
COBOL and compilers, and have not the BNF of COBOL. I just did quick mods
that *seemed* OK so as to make the code run. BTW, I found the compiler
source very clear and easy to dig into, and was able, starting from nothing,
to do the job and make the app compile (~195 KSL)in a couple of days,
including a COBOL-C interface to a screen manager.

The application I ported was running on very very old computers eg. Motorola
68040 & 88K :-)), using a very old MF compiler (from the end of the
eighties...), and all the constructs I talked about *worked* on that
compiler. I'll check for the version.

1) (END-PERFORM) and 4) (OPEN I-O a non existing file) have been changed in
the COBOL code, so no more discussion.

The only mods that I *really* would appreciate to be integrated are 2) (READ
NEXT/PREVIOUS at EOF -> error 10), 3) (READ PREVIOUS), 5)& 6) (warnings), 7)
(comments). As they are very localised, they could be ifdefed, or a standard
could be created for this compiler, eg. std=mfXXX. I have no problem
creating and using it.

I will investigate about error line numbers, there are many COPY; I am sure
the problem is on my side ;-)

Cheers,

Michel


-----Original Message-----
From: address@hidden
[mailto:address@hidden On Behalf Of Roger
While
Sent: dimanche 4 juin 2006 20:35
To: address@hidden
Subject: Re: [open-cobol-list] Compiler modifications

Michel has sent me mods off-list, so I can make some general
comments here.

<snip>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]