Re: Question regarding uniqueness
- From: "Rick Smith" <ricksmith@xxxxxxx>
- Date: Fri, 27 Jul 2007 17:01:54 -0400
"Roger While" <simrw@xxxxxxxxxxxx> wrote in message
news:f8dked$bpd$03$1@xxxxxxxxxxxxxxxxxxxx
Try to move to the VARIABLE1 at 03 :-)
I can't do it with MF SE 2.2 and 4.x :-)
Neither can I because that VARIABLE1 can not be made
unique without changing the record description or the
data-name. You wrote "Any attempt ... to reference any field";
but, in fact, only that VARIABLE1 can not be referenced.
I even went so far as to investigate the KEY phrase and,
while it can not be used with a SEARCH statement (no
index data item), it may be used with a table sort (extension
in some compilers and added to COBOL 2002).
"Rick Smith" <ricksmith@xxxxxxx> schrieb im Newsbeitrag
news:13akbf86979gc4c@xxxxxxxxxxxxxxxxxxxxx
"Roger While" <simrw@xxxxxxxxxxxx> wrote in message
news:f8cm2c$vpa$00$1@xxxxxxxxxxxxxxxxxxxx
IDENTIFICATION DIVISION.
PROGRAM-ID. t11.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 K525-AII-DRVR-RSTRT-DATA.
03 VARIABLE1 PIC X(8) VALUE SPACES.
03 K525-FRMT-FILE-ARRAY.
06 K525-FRMT-FILE-ARRAY-ROW
OCCURS 6 TIMES
ASCENDING KEY IS VARIABLE1.
09 VARIABLE1 PIC X(8) VALUE SPACES.
09 OTHER-DATA-ITEM PIC S9(5).
PROCEDURE DIVISION.
GOBACK.
This compiles with big iron and MF.
Why?
A data-name need not be unique unless it is referenced.
Current rules are at FDIS ISO/IEC 1989:2002 page 83,
8.4.1 Uniqueness of reference,
"Every user-defined name in a source element is assigned, by
the user, to name a resource that is to be used in solving a
data processing problem. (See 8.3.1.1.1, User-defined words.)
In order to use a resource, a statement shall contain a reference
that uniquely identifies that resource. In order to ensure
uniqueness of reference, a user-defined name may be qualified,
subscripted, or reference modified as described in the following
paragraphs."
One question that I considered is whether "VARIABLE1" in
the KEY phrase is unique, without explicit qualification.
According to the OCCURS clause, SR(3), this use of
"VARIABLE1" meets the requirement that it "shall be the name
of either the entry containing the OCCURS clause or an entry
subordinate to the entry containing the OCCURS clause" and,
therefore, need not be explicitly qualified; though it may be so
qualified under SR(2).
Of course, this is a stupid definition.
Any attempt in the PROC div to reference any field
would lead to a compile failure.
Not according to my tests with Micro Focus COBOL 3.2.
These statements work when inserted into the given code.
-----
move "a" to variable1 of k525-frmt-file-array-row (1)
display variable1 of k525-frmt-file-array-row (1)
-----
That is, these statements appear to meet the current standard
as well as the rules published in the LRM for that compiler.
.
- References:
- Question regarding uniqueness
- From: Roger While
- Re: Question regarding uniqueness
- From: Rick Smith
- Re: Question regarding uniqueness
- From: Roger While
- Question regarding uniqueness
- Prev by Date: Re: Web Services/XML Parser Error
- Next by Date: Re: Web Services/XML Parser Error
- Previous by thread: Re: Question regarding uniqueness
- Next by thread: Re: Question regarding uniqueness
- Index(es):
Relevant Pages
|
|