[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[open-cobol-list] Version 1.1 Bug in File-Control ?
From: |
Roger While |
Subject: |
[open-cobol-list] Version 1.1 Bug in File-Control ? |
Date: |
Thu, 21 Feb 2008 14:19:41 +0100 |
Indeed, it is defined internally which is what MF does.
You will get a warning if you specify "-Wall" when compiling -
# cobc -Wall -free mffile.cob
mffile.cob:2: Warning: AUTHOR is obsolete in OpenCOBOL
mffile.cob:3: Warning: DATE-COMPILED is obsolete in OpenCOBOL
mffile.cob:20: Warning: DATA RECORDS is obsolete in OpenCOBOL
mffile.cob:28: Warning: 'INFILE-FILE-NAME' will be implicitly defined
Essentially, OC is silent as per MF unless specific warning options
are given.
Roger
I have also seen that where the name after 'assign to' was not declared as
a variable in WS that it was declared internally so a move "fred.txt" to
undeclared-name would also work.
Don't know about OC. Why not try it and see what happens.
Vince
> The "text" after the ASSIGN TO is implementer defined and there are
LOTS of > different things that it can mean. > > SEVERAL compilers allow
one to put an "environment variable" name there. > In that case, there is
no "data-name" within the program that matches and > the file name is
found at run-time by getting it from the environment > variable. (If
there is no defined environment variable with that name and > there is
not data item with that name and the rules don't try and make the > text
itself into a physical name, then the OPEN fails). > > FYI, > The '02
Standard uses > ASSIGN USING data-name > to handle the case of getting a
value from a data name. However, I don't > know how many implementers (if
any) have adopted this. > > > -----Original Message----- > > From:
address@hidden > > [mailto:address@hidden
On > > Behalf Of Kurt Derichs > > Sent: Tuesday, February 19, 2008 5:32
AM > > To: address@hidden > > Subject: [open-cobol-list] Version
1.1 Bug in File-Control ? > > > > Hello, > > > > I was wondering weather
or not this is a compiler error that > > the following program can be
compiled without error message. > > SELECT INFILE ASSIGN TO
INFILE-FILE-NAME > > but due to a typo the variable was never defined > >
03 INFILE-FILENAME pic x(256). > > > > I tested the program on open cobol
1.1 compiled on ubuntu > > 7.10 64 bit. If you need more infos just let
me now. > > > > Bye > > > > Kurt > > > > PS: I registered in the
OpenCobol Forum but I can login. > > Perhaps someone can help me with
this as well. > > > > PROGRAM-ID. hello > > AUTHOR. Kurt Derichs > >
DATE-COMPILED. 20080210 > > > > ENVIRONMENT DIVISION. > > CONFIGURATION
SECTION. > > SOURCE-COMPUTER. x86. > > OBJECT-COMPUTER. x86. > > > >
INPUT-OUTPUT SECTION. > > FILE-CONTROL. > > SELECT INFILE ASSIGN TO
INFILE-FILE-NAME > > ORGANIZATION IS LINE SEQUENTIAL > > ACCESS MODE IS
SEQUENTIAL > > FILE STATUS IS INFILE-ERR-STATUS. > > > > DATA
DIVISION. > > FILE SECTION. > > FD INFILE > > data record is
infile-satz. > > 01 INFILE-SATZ PIC X(80). > > > > WORKING-STORAGE
SECTION. > > 01 INFILE-DATA. > > 03 INFILE-FILENAME pic x(256). > > 03
INFILE-ERR-STATUS pic 99. > > > > PROCEDURE DIVISION. > > start-10. > >
move "/tmp/test" to infile-filename. > > move zero to
infile-err-status. > > open input infile. > > close infile. > > > >
start-99. > > STOP RUN.