Skip to content

Sample REXX EXEC CMN010 XML Setup and Call

/* Set variables for XML call */

Init_XMLStem1: 
     rxrc          = 0       /* initialize our return code */ 
     stem          = "SER1." /* set outgoing stem name */
     SER2.         = ""      /* initialize outgoing stem */ (see note 1)
     SER1.         = ""      /* initialize outgoing stem */
     SER1.Subsys   = subname /* subsystem name to query */  (see note 2)
     SER1.Userid   = tsoname /* userid */
     SER1.Test     = tst     /* set test value */
     SER1.Product  = "CMN "  /* set product */              (see note 3)
     SER1.Service  = "PARMS" /* set service*/               (see note 4)
     SER1.Message  = "LIST"  /* set message */
     SER1.Scope    = "APL"   /* set scope */
     SER1.applname = appname /* set application name */
                             /* set result set to return */
     SER1.includeInResult.1 = "applName" 
Return

Notes

  1. This clears the stem and defines all possible values starting with an empty string.
  2. This nominates the subsystem that you are communicating with.
  3. The product code defaults to CMN. There may be other products later.
  4. Both Service and Message are compulsory. Scope is optional and defaults to SERVICE if omitted.
/* XML service call */

Serxmlrc: 
   address LINKMVS "SERXMLRC stem" 
   rxrc=rc                             (see Note 1)  
   if rxrc<>0 then call Diagnose_Error (see Note 2)
Return

Notes

  1. Rxrc is a copy of the return code. The REXX variable rc is special in that it is the return code of the latest external operation. Therefore, it is good practice to record the rc in a separate variable after every external call.
  2. Error diagnostics are only needed if there is an error.