Use the LOCIMOD() function to determine the availability of an IMOD subroutine before you try calling it.
The LOCIMOD() function has this format:
address {GOOD|BAD} {CALL|NCALL} {SOURCE|NSOURCE} = LOCIMOD(imodname)
The LOCIMOD() function takes these arguments:
|
address |
IMOD's memory address (in REXX decimal format). |
|
GOOD |
The IMOD was successfully loaded and is executable. |
|
BAD |
An error occurred during IMOD loading and the requested IMOD is not executable. |
|
CALL |
The IMOD is available to be called as a subroutine from another IMOD. |
|
NCALL |
The IMOD cannot be called as a subroutine from another IMOD. |
|
SOURCE |
The IMOD's source code is in memory and is available to the SOURCELINE() function and TRACE facility. |
|
NSOURCE |
The IMOD's source code was not loaded into memory and is not available to the SOURCELINE() function or TRACE facility. |
|
imodname |
Name of the IMOD to be tested. This argument is not case-sensitive. |
An IMOD that has not been loaded sets RC to 121. An IMOD that has been loaded but is not currently available sets RC to 0 and returns BAD as the status.
The LOCIMOD() function produces these return codes:
101 ARG 1 MISSING OR INVALID
121 NOT FOUND
Example
Consider this example:
/* Conditionally send a message to a logging subroutine. If the
subroutine is not available, issue the message as a WTO */
parse arg msg
status = locimod('log_routine')
if RC = 0 then do
parse var status w1 w2 w3 .
if w1 = 'BAD' then RC = 121
if w2 = 'NCALL' then RC = 121
end
if RC = 0 then do
call log_routine msg
return
end
x = wto(msg)
return
| Copyright © 2011 CA. All rights reserved. | Tell Technical Publications how we can improve this information |