Previous Topic: LOCATE()Next Topic: LOCSTEM()


LOCIMOD()

This function determines the availability of an IMOD subroutine before you try calling it.

Syntax

address {GOOD|BAD} {CALL|NCALL} {SOURCE|NSOURCE} =  LOCIMOD(imodname)

Parameters

address

Memory address for the IMOD (in REXX decimal format).

GOOD

IMOD was successfully loaded and is executable.

BAD

An error occurred during IMOD loading and the requested IMOD is not executable.

CALL

IMOD is available to be called as a subroutine from another IMOD.

NCALL

IMOD cannot be called as a subroutine from another IMOD.

SOURCE

Source code for the IMOD is in memory and is available to the SOURCELINE() function and TRACE facility.

NSOURCE

Source code for the IMOD 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.

Usage Notes

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.

Return Codes

101

ARG 1 MISSING OR INVALID

121

NOT FOUND

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