Accessing the API environment
The REXX runtime interface does not require any translation of API commands. The commands are interpreted by a REXX function package that is supplied by CICSPlex® SM.
For instructions on installing the REXX function package, see Installing the REXX function package.
The first call to CICSPlex SM in your program must be an EYUINIT or EYUAPI function. EYUINIT is the primary means of initializing the API environment. However, if EYUINIT is not issued first, the EYUAPI function initializes the environment.
Say 'Initializing API...'
XX = EYUINIT()
If XX <> 0 Then Signal UNEXPECTED
Say 'Establishing connection...'
XX = EYUAPI('CONNECT' ,
'CONTEXT('W_CONTEXT')' ,
'SCOPE('W_SCOPE')' ,
'VERSION(0310)' ,
'THREAD(W_THREAD)' ,
'RESPONSE(W_RESPONSE)' ,
'REASON(W_REASON)')
If XX <> 0 Then Signal UNEXPECTEDIn this example, the EYUINIT function is issued first to initialize the API environment. Then an EYUAPI function is used to issue the API CONNECT command.
- Issue any other CICSPlex SM function.
- Access the host subcommand environment by issuing the REXX ADDRESS command.
XX = EYUAPI('TERMINATE RESPONSE(W_RESPONSE) REASON(W_REASON)')
XX = EYUTERM()In this example, the EYUAPI function is used to issue an API TERMINATE command. Then EYUTERM is issued to terminate the API environment and release its allocated resources.
Using the EYUTERM function is always a good idea. However, if the CICSPlex SM host subcommand environment is installed at your enterprise (as opposed to being called from the function package), you may not need to use the EYUTERM function at the end of every program. Depending on the programming guidelines at your enterprise, the REXX resources that remain allocated can be reused by the next CICSPlex SM API program that accesses the host subcommand environment.