[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [open-cobol-list] TABLES and TEXT
From: |
Brian Tiffin |
Subject: |
Re: [open-cobol-list] TABLES and TEXT |
Date: |
Thu, 21 Feb 2013 16:00:38 -0500 |
User-agent: |
Opera Mail/12.14 (Linux) |
On Thu, 21 Feb 2013 14:03:28 -0500, Robert Wolfe
<address@hidden> wrote:
Hi all!
New to COBOL and trying to learn it by looking at online resources plus
working with my housemate, who does RPG and COBOL programming on the
iSeries platform.
I am working on a small program that uses tables and when I go to run
the cobc -x command to compile the code, I get the following errors:
address@hidden:~/cobol$ cobc -x tables.cob
tables.cob:4: Error: 'table' reserved word, but not supported yet
tables.cob:30: Error: 'text' reserved word, but not supported yet
tables.cob:19: Error: Level 01 item 'result' cannot have OCCURS clause
tables.cob:27: Error: Level 01 item 'res-text' cannot have OCCURS clause
tables.cob: In section 'main':
tables.cob:51: Error: 'text' reserved word, but not supported yet
Welcome to OpenCOBOL Robert. Change the variable names 'table' to
something like a-table, text to some-text, and then move the OCCURS down
one grouping level. Heady stuff for beginning, but it'll all make sense
soon.
Looking at the line numbers, I'm guessing you have PROGRAM-ID. table.
Change that name to tableing or some such.
COBOL is a reserved word rich language, and COBOL developers soon learn to
avoid variable names that have ANY similarity to english, as the next
Draft standard could well use them as reserved words. For a list of
avoidable names, see cobc --list-reserved (and any other --list-xxx args
that cobc --help shows. --list-intrinsics etc.
OpenCOBOL, being tightly bound with C, means it is also a good idea to
avoid C keywords as well, so no
PROGRAM-ID. int.
as that would be asking for grief of unknown quantities and qualities.
On the OCCURS. Set up the structure as
01 result-table.
05 result-items PIC x(10) occurs 10 times.
There are configuration options to allow 01 level occurs, but it isn't the
standard way of doing things, and access to the elements of result-items
is the same in the procedure division source anyway. result-item(3)
would implicitly know it's part of the result-table group.
In default.conf (under /usr/share/open-cobol or
/usr/local/share/open-cobol for GNU/Linux) there is
top-level-occurs-clause: skip
but I never play with that one, so can't speak to the facts and not overly
sure what happens when set to
top-level-occurs-clause: ok
Feel free to ask more, but if you do and the source code isn't secret,
post it along with the questions and you'll get more detailed responses.
If it helps any, 'cobc --version' returns the following information:
address@hidden:~/cobol$ cobc --version
cobc (OpenCOBOL) 1.1.0
Copyright (C) 2001-2009 Keisuke Nishida / Roger While
Built Feb 21 2013 10:50:17
Packaged Feb 06 2009 10:30:55 CET
Thanks for any insight anyone can give this newbie.
Cheers,
Brian