[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [GNU-COBOL] COBOL considered as a RIS high-level language
"David L. Nicol" wrote:
> Fred Mobach wrote:
> > Name: index01.cbl.gz
> > index01.cbl.gz Type: application/gnu
> > Encoding: base64
>
> Looks good
>
> Are all of these assertions true?
>
> * is the comment character
Yes, if it's in position 7 of the record.
> Empty lines are an error, so empty lines must have a * so they are not
> empty
The first time I saw an empty line I was astonished, but there are compilers
that accept those lines and gives it a linenumber also. They are treated as
comment lines.
> The initial line number is for reference only, GO TO uses named labels
Exactly.
> Data structures are declared in "WORKING-STORAGE SECTION" which
> may include default values
Data structures which are describing the own storage are of the compile unit are
declared in the "WORKING-STORAGE SECTION". These data structures can have
initial values specified by the VALUE clause.
In the FILE SECTION data structures related to the record structures of the
files to be processed are declared.
In the LINKAGE section data structures are declared, which describe the
arguments specified when calling that compile unit as subroutine.
Then we know also of a REPORT SECTION which I refused to use :-).
> subroutines do not need to be predeclared, and they are defined
> with two dots after their section names
Sorry, they are defined with one dot followed by one space after the term
SECTION. Between SECTION and the dot many spaces are allowed. Please don't name
this a subroutine, it's a section.
A subroutine is a seperate compile unit which can be written in any programming
language. Calling and called compile unit are linked together by the linker and
depending upon the platform that can be done by static or dynamic linking.
> Line labels are local to sections.
Yes. That's what they call a paragraph name in Cobol.
> P00 and EOS are customary for entry and exit points of a
> section but are not required for a correct program
Everybody has his own naming conventions. I'm used to P[aragraph]00 as entry
point and E[nd] O[f] S[ection] as exit point. You do need at least one paragraph
name between the section declaration and the first executable statement.
> section definitions are terminated with a / on a line by itself
Not at all. The slash in position 7 is used by many Cobol compilers to force a
form feed on the compilation listing. The rest of the line can be filled with
comment. And I like sections to start on a new page.
A section terminates when another section is started, at the end of the compile
unit and at the end of the source.
> subroutine calls require the PERFORM keyword
If you replace 'subroutine' by 'section' : Yes.
Note however, it's permitted to branch to a section with the GO TO statement.
But those who do should be fired. And the gnu-cobol compiler is assumed to
support it.
> 000610 01 DATUM-TIJD-VELDEN.
> 000620 03 DATUM PIC 9(06).
> 000630 03 FILLER REDEFINES DATUM.
> 000640 05 SYS-JJ PIC 99.
> 000650 05 SYS-MM PIC 99.
> 000660 05 SYS-DD PIC 99.
> 000670 03 TIJD PIC 9(08).
> 000680 03 FILLER REDEFINES TIJD.
> 000690 05 SYS-UUR PIC 99.
> 000700 05 SYS-MIN PIC 99.
> 000710 05 SYS-SEC PIC 99.
> 000720 05 SYS-HSS PIC 99.
>
> Are 01,03,05 always 01,03,05? Can there be 07,09,11, and
> on in deeper, using objects that have been describes already?
Again this is personal preference for the most.
The start of an area is declared by the level 01. To subdive that area you can
use the levels 02 - 49. Some people uses an interval of 2, other 5. Needed is of
course an interval of 1 at least.
> Are these tags required and are they always odd numbers?
These levels are required but can be 01 - 49.
> these declarations describe specific locations rather than
> defining of structure types which will be later mapped on
> to memory blocks (as in C or C++ ); COBOL works with
> one record at a time by reading it into a defined record structure,
> yes? (which leaves room available for incredible speed through
> record locking and parallelism)
These declarations describe the structure of an area, in this case first a data
field of 6 bytes and then a tiem field of 8 long. The structure of the area's of
the working storage section will be mapped on to memory blocks. But don't ask me
how that works in the Linux environment, no time to study the loader now :-).
Regards,
Fred Mobach
--
This message was sent through the gnu-cobol mailing list. To remove yourself
from this mailing list, send a message to majordomo@lusars.net with the
words "unsubscribe gnu-cobol" in the message body. For more information on
the GNU COBOL project, send mail to gnu-cobol-owner@lusars.net.