Re: Question regarding uniqueness
- From: "Rick Smith" <ricksmith@xxxxxxx>
- Date: Fri, 27 Jul 2007 13:37:39 -0400
"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.
.
- Follow-Ups:
- Re: Question regarding uniqueness
- From: Roger While
- Re: Question regarding uniqueness
- References:
- Question regarding uniqueness
- From: Roger While
- Question regarding uniqueness
- Prev by Date: Re: unstring empty string
- Next by Date: Re: unstring empty string
- Previous by thread: Re: Question regarding uniqueness
- Next by thread: Re: Question regarding uniqueness
- Index(es):
Relevant Pages
|
|