As I want to make a SB+ process available via SOA, I have been giving some thought to how to correctly call a process.

A SB+ process works like a function call:

RESULT = FUNCTION(DATA.IN)

where:

DATA.IN is the @PARAM common variable and RESULT is the @VALUE common variable. There is also an error return, passed by @RTN.FLAG.

But this breaks down with some routines when a multivalued lists has to be passed as @PARAM is for comma separated text only. In this situation, @VALUE is used to pass in data also.

Therefore, an SB+ process works as:

CALL SB.PROCESS(PARAM.IN, EXTENDED.IN, RESULT.OUT, ERR.OUT)

where:

  • PARAM.IN = @PARAM
  • EXTENDED.IN = @VALUE
  • RESULT.OUT = @VALUE
  • ERR.OUT = @RTN.FLAG

Also as these variables are in the SB+ common, it is equivalent to passing by pointer or by reference (see HELP BASIC CALL for more info).

Therefore, to wrap a SB+ process to be called as a SOA/SOAP/web service may look like:



SUBROUTINE SOA.SB.PROCESS(IN.PROCESS, IN.PARAM, IN.VALUE, OUT.VALUE, OUT.RTN.FLAG)
******************************************************************
* Enable to call a SB.PROCESS via SOAP
*
* INPUT:
*        IN.PROCESS - The process name to run
*        IN.PARAM   - The standard PARAM comma delimited string
*        IN.VALUE   - Extended parameters, if needed
*
* OUTPUT:
*        OUT.VALUE    - The returned value
*        OUT.RTN.FLAG - The RTN.FLAG from the process
*
* Copyright David Murray 2006
*
******************************************************************
*
* R0 - 16/10/06 - DJM - Created

      INCLUDE DMSKELCODE COMMON
      INCLUDE DMSKELCODE STANDARD.EQU

      EQUATE EMPTY.STR TO ''

      PROCESS.NAME = IN.PROCESS
      PARAM        = IN.PARAM
      VALUE        = IN.VALUE

      CALL SB.PROCESS(PROCESS.NAME)

      OUT.VALUE    = VALUE
      OUT.RTN.FLAG = RTN.FLAG

      RETURN

You may want to check PROCESS.NAME for a valid SB+ process name before calling SB.PROCESS.

save.run.done