HOME  NEWS  FORUM  DOWNLOAD  LINK
OpenCOBOL - an open-source COBOL compiler
Main Menu
Download
Documentation
Development
Who's Online
11 user(s) are online (6 user(s) are browsing Forum)

Members: 0
Guests: 11

more...
Powered by
SourceForge

Xoops

Creative Commons

OpenCOBOL Forum Index
   OpenCOBOL
     Migrating from MF to OC: "Indexed by"
Register To Post

Threaded | Newest First Previous Topic | Next Topic | Bottom
Poster Thread
geert
Posted on: 2008/4/14 10:21
Just popping in
Joined: 2008/4/11
From:
Posts: 16
Migrating from MF to OC: "Indexed by"
Hi all,

in my cobol programs I have a variable with an index:
01 EUXXV.
...
07 TABDIN OCCURS 00020 INDEXED BY NUMDIN.

when I want to put this index on 1 like the following line, I got an error from cobc.
SET NUMDIN OF EUXXV TO 1.

Error: 'NUMDIN' in 'EUXXV' undefined

This isn't normal, is it? I think it is a bug, I created already a bug report on the sourceforge page (request ID:1939997)

Is there a workaround for this problem?

Best regards,
Geert
geert
Posted on: 2008/4/15 12:47
Just popping in
Joined: 2008/4/11
From:
Posts: 16
Re: Migrating from MF to OC: "Indexed by"
Hi,

I found the problem. When using an indexed by the INDEXED BY construction cobc will create a global variable in his generated C-code and this must be logically unique. There is no need to specify the table.

In my case this results in:
SET NUMDIN TO 1.

Best regards,
Geert
simrw
Posted on: 2008/4/16 7:33
Webmaster
Joined: 2005/5/31
From: Bad Soden, Germany
Posts: 776
Re: Migrating from MF to OC: "Indexed by"
Actually, according to the standard, qualification
of an INDEXED BY item is allowed.
So, the following is valid code and should
be correctly interpreted by OC (I have a fix in test) -

01 AA.
03 BB PIC X OCCURS 10 INDEXED BY ZZ.
01 CC.
03 DD PIC X OCCURS 10 INDEXED BY ZZ.

Note that the 2 "ZZ" items are 2 unique fields.

SET ZZ OF BB OF AA TO 1.
or (in this case)
SET ZZ OF AA TO 1.

Also qualification is allowed even if the
referenced item is unique.

I will post when the fixes have been
included in the 1.1 tarball.

Roger
simrw
Posted on: 2008/4/16 14:57
Webmaster
Joined: 2005/5/31
From: Bad Soden, Germany
Posts: 776
Re: Migrating from MF to OC: "Indexed by"
OK. Fix applied.
OC 1.1 tarball updated.

Roger
Threaded | Newest First Previous Topic | Next Topic | Top

Register To Post
 
Copyright (C) 2005 The OpenCOBOL Project. All rights reserved.
Powered by Xoops2 | PHP | MySQL | Apache
ocean-net