Question
Sehinde Raji · Aug 21, 2021

Unable to get user defined function to work (set occupiedseatsAdj=$$occupiedseatsAdj(.initialArr,.loc,.row produces error <NOLINE>There has been an attempt to refer to a nonexistent routine line.)

Hey everyone as you may know I am a beginner and I am kindly asking for some assistance in a problem I have been solving. The problem is that I am calling a user defined function within a procedure called occupiedseatsAdj and the compiler comes up with this error. 

<NOLINE> There has been an attempt to refer to a nonexistent routine line.

From what I understand I can call a user defined function from within a procedure (correct me if I am wrong) as shown below. Is this the correct way or should I create a .Mac file and include it somewhere within the above mentioned cls file ? I understand the fact that you can use do to call functions the trouble is that I can't return anything back from these procedures and ideally I would like to be able to do that.

Here is my code snippet and assistance is greatly appreciated.

 

Class Missing.Seats Extends %RegisteredObject

{

ClassMethod findnextSeat(initialArr As %ArrayOfDataTypes, ByRef count As %Integer)

{

set occupiedseatsAdj=$$occupiedseatsAdj(.initialArr,.loc,.row)

 

}

ClassMethod occupiedseatsAdj(initialArr As %ArrayOfDataTypes, J, K)

{

for adjj=J-1:1:J+1 {

for adjK=K,-1:1:K+1

{

if adjK=K, adjJ=J continue

if $EXTRACT($GET(initialArr(adjK)),adjJ)="#"

set total=total+1

}

}

}

}

Product version: IRIS 2021.1
$ZV: IRIS for UNIX (Ubuntu Server LTS for x86-64 Containers) 2021.1 (Build 215U) Wed Jun 9 2021 12:37:06 EDT
00
1 0 2 64
Log in or sign up to continue

It’s a class not routine, and you call to method not label, so instead of double dollar, you have to use double dots 

..occupiedseatsAdj

Thank you very much for your explanation. I changed it and the compiler works.....