Previous Topic: FIND FunctionNext Topic: OPSARM Function


INDEX Function

The INDEX function returns the position of the first character of string2 in string1. If string1 does not contain string2, OPS/REXX returns 0. The search for string2 begins at the first character of string1 unless you specify a startingposition for the search.

Note: Use the INDEX function in OPS/REXX or AOF rules. REXX code that uses the INDEX function invokes the TSO/E REXX version of the function when running under TSO/E.

INDEX has the following format:

var = INDEX(string1,string2[,startingposition])
INDEX(string1,string2)

Performs the same operation as the POS(string2,string1) function of TSO/E. For new code, use POS, not INDEX. Both functions support an optional startingposition parameter, but the first two arguments are swapped.

OPSAPI Function

The OPSAPI function lets you create a Generic Event API OPS/MVS event from any supported REXX environment. The event can be used to trigger one or more )API automation rules.

OPSAPI has the following format:

OPSAPI(“EVTCODE(‘eventcode’) EVTTEXT(‘text’)”)
EVTCODE(Eventcode)

Defines the eventcode that is passed to the API rule. The eventcode can be any ten character string and it is required. The eventcode argument is translated to upper-case prior to being passed to the API rule.

EVTTEXT(Text)

Defines the text string that is passed to the API rule. The event text is optional, and it can be up to 255 bytes in length, and it is not case-sensitive.

Example: OPSAPI

/* REXX program to use the OPSAPI function */                      
setvar = OPSAPI("EVTCODE('OPWSTEST') EVTTEXT('HELLO WORLD!')")     
SAY "OPSAPI test completed!"                                       
SYNTAX:                                                            
  Do QUEUED()                                                      
    PULL Err_Info                                                  
    SAY '*** ' Err_info                                            
  END                                                              

Example: OPSAPI API Rule

)API OPWSTEST                                 
)PROC                                         
SAY 'API.APPLICATION= ' API.APPLICATION       
SAY 'API.ID=' API.ID                          
SAY 'API.TEXT=' API.TEXT                      
SAY 'OPSAPI Rule has fired!'

Utilization Environments

Use the OPSAPI within OPS/REXX programs, TSO/E programs, or OMVS scripts. Additionally, an OPSAPI command processor version of this function exists. Use this version from the TSO foreground or in batch, if needed.

The OPSAPI function returns a return code value.

Note: An error message sometimes accompanies the return code value.

OPSAPI returns the following possible values:

0

Request successfully processed

12

Storage failure

28

Authorization failed

40

Invalid function arguments