JSM_SCRIPT

LANSA Composer

JSM_SCRIPT

This activity will execute a script of LANSA Integrator JSM commands.

The JSM command script may contain substitution variables that are replaced at run-time by the values of Processing Sequence variables.  See below for details on this feature.

Note that JSM commands executed using this activity are not able to pass or receive LANSA variables or working lists to or from the LANSA Integrator service.  This fact will restrict the services and/or the selection of service commands that may usefully be executed using this activity.

Due to this restriction and limited error handling and recovery capabilities, the activity is intended only for relatively simple LANSA Integrator service command sequences.  You should consider using one of the purpose-specific supplied activities or creating your own custom activity for more advanced applications.

As soon as this activity begins to execute the JSM command script, the restartable flag is set OFF.  It is not possible to restart a processing sequence that ends in error in this activity after it begins to execute the JSM command script.

INPUT Parameters:

JSMSERVICE : Optional

This parameter can contain the name of the JSM service to be loaded.  If specified, the activity will load the JSM service at the beginning of execution and unload it when complete.  If a single service is being used, this is the preferred technique because it allows the activity to respect and exploit applicable LANSA Composer settings and functionality, such as LANSA Composer features supporting LANSA Integrator tracing.  If not specified, then the JSM script must contain the necessary SERVICE_LOAD and SERVICE_UNLOAD commands to load and unload the required JSM service.

JSMSCRIPTFILE : Optional

This parameter is optional, but if it is not provided, then you must provide the JSM command script through the JSMSCRIPTLIST parameter.  If this parameter is provided, then it must specify the full path to a text file that contains the JSM command script to be executed.  See JSM command Script below for more information.

JSMSCRIPTLIST : Optional

This parameter is optional, but if it is not provided, then you must provide the JSM command script through the JSMSCRIPTFILE parameter.  If this parameter is provided, then it must contain a list of the JSM commands to be executed.  See JSM command Script below for more information.

JSMERRORACTION : Optional

This parameter specifies the action the activity should take if any command in the specified JSM command script results in an error.  You can specify one of the following values:

*ERROR     : the activity immediately ends in error without executing further JSM script commands

*CONTINUE  : the activity continues to attempt to execute remaining JSM script commands, but when complete, ends with a warning status

If not specified (or if an unrecognised value is specified), the activity assumes a default value of *CONTINUE.

OUTPUT Parameters:

JSMSTATUS:

Upon completion, this parameter will contain a list of the JSM status codes (eg: 'OK' 'ERROR' ...) resulting from executing the JSM script commands.  Only status codes resulting from script commands are included - the list does NOT include status codes resulting from opening or closing the JSM connection or from loading or unloading the service (unless the service load or unload results from commands in the JSM script).  Therefore the sequence of the status codes in the list corresponds directly to the sequence of the JSM commands executed.

JSMMESSAGE:

Upon completion, this parameter will contain a list of the JSM messages resulting from executing the JSM script commands.  Only messages resulting from script commands are included - the list does NOT include messages resulting from opening or closing the JSM connection or from loading or unloading the service (unless the service load or unload results from commands in the JSM script).  Therefore the sequence of the JSM messages in the list corresponds directly to the sequence of the JSM commands executed.

JSMERRORCOUNT:

Upon completion, this parameter will contain a count of the JSM command script commands that ended in error.  If *ERROR is specified for the JSMERRORACTION parameter, this count will always be either zero or 1 because the first error terminates the JSM command script execution.

JSM Command Script

Whether you specify your JSM command script through the JSMSCRIPTFILE or JSMSCRIPTLIST parameters, you should compose your script according to the following guidelines:

  • Your script can consist of any JSM service commands valid for the JSM service loaded and according to the JSM service documentation, providing that the commands used do not rely upon passing program variables or lists to or from the LANSA Integrator service
  • Each JSM service command should be on a separate line or in a separate list entry
  • Lines or list entries beginning with '*' are ignored and may contain comments

Refer to the LANSA Integrator documentation for information about the supported JSM services and service commands.

Substituting Processing Sequence Variables in the JSM command script

The activity supports substitution variables in the JSM command script.  When found, they will be replaced by the value of the named variable in the Processing Sequence variable pool.

You can specify a substitution variable in the following form:

   %%var.<variable-name>%%

where <variable-name> is the name by which the variable is known in the Processing Sequence variable pool.  See the example JSM command script below for an example of using substitution variables.

If you specify substitution variables in your JSM command script, it is your responsibility to ensure that the variables named exist and have valid values assigned to them in the Processing Sequence that uses the script. The variables values may be set by any supported means - for example, they might be received as Processing Sequence parameters, explicitly set with an ASSIGN directive, or set as the result of running some other activity.  If the named variables do not exist in the Processing Sequence when the JSM command script is executed, this activity will issue a warning but execution will continue (the variable reference is removed from the JSM command).

Note that the following advanced forms of variable references are NOT supported by this feature:

1. Compound or qualified variables - for example: *tradingpartner.xxx

2. Indexed variables - for example: mylist(3)

Typically you could circumvent these limitations, if necessary, by assigning the desired compound or indexed variables to a simple variable name before executing the script.

Example JSM Command Script

This is a sample JSM command script that is intended to delete records from the LANSA Composer tutorial orders database tables TUTORDH and TUTORDL using the LANSA Integrator SQLService.  It uses substitution variables for the database user and password and for the BCHNUM database field value that identifies the records to be deleted.  It is the responsibility of the solution designer to ensure that corresponding processing sequence variables exist with appropriate values before executing this script using the JSM_SCRIPT activity.

****************************************************************

* This is a sample JSM command script

****************************************************************

CONNECT DRIVER(TUT) DATABASE(TUT) USER(%%var.USER%%) PASSWORD(%%var.PASSWORD%%)

SET AUTOCOMMIT(*YES)

EXECUTE UPDATE("DELETE FROM TUTORDL WHERE BCHNUM = '%%var.BCHNUM%%'")

EXECUTE UPDATE("DELETE FROM TUTORDH WHERE BCHNUM = '%%var.BCHNUM%%'")

DISCONNECT

************************************

 

Note that the example above would require entries similar to the following to be added to LANSA Integrator's SQLService.properties file in order to operate successfully.  This is a requirement of the particular JSM service and service commands being used - it does not apply to the JSM_SCRIPT activity in general.  You should refer to the LANSA Integrator documentation for information about requirements and considerations that apply to the JSM service and service commands that you are using.

#

driver.tut=com.ibm.as400.access.AS400JDBCDriver

database.tut=jdbc:as400://SYSTEM/LICLICLIB;naming=sql;errors=full;date format=iso;translate binary=true

#