Reputation:
I'm trying to display some data that I'm reading into a table. However, I keep getting the error:
IN-FUND-NBR was not a uniquely defined name...Expected a reference-modification specification but found ")".
***EDIT: Okay, so I found the root of the problem. However, can't I still access IN-FUND-NBR
as it sits? I tried the following, but it does not work:
DISPLAY "IN-FUND-NBR = " IN-FUND-NBR (MF-SALE-SUB) OF IN-MF-SALE
***END EDIT
I have the following record defined as follows:
01 SALES-RECORD.
05 IN-CITY-NAME PIC X(20).
05 IN-CUSTOMER-NAME PIC X(20).
05 IN-MF-SALE OCCURS 4.
10 IN-FUND-NBR PIC 9(2).
10 IN-PRICE-FLAG PIC 9.
10 IN-PURCH-AMT PIC 9(5)V99.
I'm trying to extract the first instance of IN-FUND-NBR by doing the following in a paragrah:
PERFORM
VARYING MF-SALE-SUB FROM 1 BY 1
UNTIL MF-SALE-SUB > 4
DISPLAY "Fund Number: " IN-FUND-NBR(MF-SALE-SUB)
END-PERFORM.
Upvotes: 0
Views: 2424
Reputation: 13076
In your program you have IN-FUND-NBR
defined more than once. The other definition(s) may be in a copybook, or something you have coded yourself without realising. The compiler discards the reference to the field.
The second diagnostic message about the reference-modification is because having discarded the reference to your data-name the compiler then encounters the opening parenthesis and your subscript. This message will disappear when you correct the problem.
Either, ensure that the data-names are unique. Or, in the nutty situation that this is not possible, you have to use qualification
. You do this by using IN or OF and referencing a higher level data-name.
From what you have shown:
DISPLAY "Fund Number: " IN-FUND-NBR OF SALES-RECORD (MF-SALE-SUB)
should work.
Although you can use qualification
to get around the problem, many are like me and find it a complete waste of time and patience, and others, especially beginners, find it a source of confusion. Try your best to always have unique data-names.
Upvotes: 0