Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"USER WORD 'CHAR-COUNT' IS MULTI-DEFINED." error not sure what means 1

Status
Not open for further replies.

scottmitchell

Programmer
Joined
Sep 7, 2002
Messages
11
Location
US
Anyone who can shed some light on this error, I'd love to hear from you!

I have a variable in working storage called "char-count" and I have it as an index for several tables, and also present in some procedure code as follows:

PERFORM PROCESS-CHAR VARYING CHAR-COUNT FROM 1 BY 1
UNTIL CHAR-COUNT > 60.

I get an compile error for this line of code saying,

"DECODE.COB 103: JMN2504I-S USER WORD 'CHAR-COUNT' IS MULTI-DEFINED."

What can I check to get rid of this error?

Thanks!

Scott
 
Hi,

there must be two or more declarations for CHAR-COUNT.

like this:

03 XXX.
05 CHAR-COUNT PIC 9(09) COMP.
03 YYY.
05 CHAR-COUNT PIC 9(09) COMP.

The line "MOVE 0 TO CHAR-COUNT" will generate this error because the compiler doesn't know which of the two is meant.

Solution 1: Give one of the CHAR-COUNT fields a different name.
Solution 2: Use the "IN" word, like : "MOVE 0 TO CHAR-COUNT IN XXX."
Marcel
 
Hi scottmitchell,

Could it also be that the name char-count is already used to define an index? Index declarations appear in the phrase INDEXED BY, not as elementary items. Use a different name for your WORKING STORAGE char-count (it is a subscript, not an INDEX).

Dimandja
 
thanks guys for your input...

I did some reading and found that, as Dimandja had pointed out, I had used it more than once to define multiple indexes. Problem solved!

Thanks so much for your input!

Sincerely,

S. Mitchell
 
While not recommended, you can qualify a duplicate index name. e.g.

Code:
05  XXX OCCURS 10 TIMES INDEXED BY IDX PIC X.
05  YYY OCCURS 10 TIMES INDEXED BY IDX PIC X.
.
.
.
     PERFORM PROCESS-CHAR VARYING IDX OF XXX FROM 1 BY 1
            UNTIL IDX OF XXX > 60
[\code]
Glenn
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top