AS/400 Adapter 6.0.1 | webMethods AS/400 Adapter Documentation | webMethods AS/400 Adapter Installation and User’s Documentation | Built-in Services | Access Services | wm.as400.access:callProgram
 
wm.as400.access:callProgram
Calls an iSeries program. This service allows a user to call an iSeries server program, pass the input and the output parameters, and access data returned in the output parameters after the program runs.
Input Parameters
$AS400Alias
String The connection alias of the AS/400 server.
$AS400
com.ibm.as400.access.AS400 Optional. A connected AS/400 object.
Note:
Either $AS400 or $AS400Aliasshould be provided as an input.
programName
String The name of the program to call. The program name must be 1 to 10 characters.
Example:
FIRSCL
Note:
Use the libraryName field to specify the program library else the programName should contain the fully qualified integrated file system path name of the program.
Example:
/QSYS.LIB/myLibrary.LIB/myProgram.PGM
libraryName
String Optional. The library in which the program exists. It must be 1 to 10 characters.
Note:
Use this field only if programName does not contain the fully qualified integrated file system path name for the program.
If you specify libraryName as %ALIAS_CURLIB%, then the library name specified as the current library while configuring the connection alias is used.
Note:
You cannot specify %ALIAS_CURLIB% if the $AS400Aliasfield is empty.
isThreadSafe
String Set to true if the program should be assumed to be thread-safe on the server, else set to false.
inquiryMessageReply
String Job attribute representing how a job answers inquiry messages. The possible values are:
*INQUIRY_MESSAGE_REPLY_DEFAULT
A constant indicating that the system uses the default message reply to answer any inquiry messages issued while this job is running.
*INQUIRY_MESSAGE_REPLY_SYSTEM_REPLY_LIST
A constant indicating that the system reply list is checked to see if there is an entry for an inquiry message issued while this job is running.
*INQUIRY_MESSAGE_REPLY_REQUIRED
A constant indicating that the job requires an answer for any inquiry messages that occur while this job is running.
maxByteSize
String Specifies the size of the largest program parameter (either input or output) in bytes.
RecordMetaData
Record Definition of the program parameters (both input and output in the correct order) as follows:
*DataName. The name of the program parameter.
*DataType. The AS/400 data type of the program parameter.
*DataLength. The length of the program parameter. For decimal types type xx.yy, for example, 5.2.
recordData
Record Optional. Specifies the program parameter values (Name/Value Pair) as follows:
*Name. The name of the input parameter.
*Value. The value of the input parameter.
Output Parameters
Success
String The status of the program. Contains true if the program call was successful else contains false.
AS400MessageList
Record List of AS/400 messages returned while running the program. It returns an empty list if there are no messages. It returns the following fields:
*messageID. The message ID of the AS/400 message.
*messageText. The message text of the AS/400 message.
recordData
Record Contains both the input and the output program parameter values (Name/Value Pair) as follows:
*Name. The name of the input/output parameter.
*Value. The value of the input/output parameter.
Example
wm.as400.sample.rpg:firstCL
Usage Notes
*To invoke an RPG program, first find out the parameter definition of the RPG program and then build the input record RecordMetaData to exactly define the program parameters.
For example, if your program (FIRSTCL) takes one input parameter of type String and length 10 bytes and returns one output parameter of type String and length 2 bytes the RecordMetaData appears as follows:
recordMetaData
recordMetaData[0]
DataName
"IN"
DataType
"String"
DataLength
"10"
recordMetaData[1]
DataName
"OUT"
DataType
"String"
DataLength
"2"
Corresponding to the RecordMetaData, build the recordData structure to pass the input values.
recordData
IN
The name of the input variable should match the name in the DataName field defined in the RecordMetaData record. If the input field is not found in the recordData record, then the default value of that data type is sent to the program.
The field maxByteSize is equal to the absolute maximum value of the DataLength values in the input record RecordMetaData. In this case the value is:
maxByteSize
"10"
After execution, the record recordData contains the input and the output fields and the corresponding values returned by the programs.
recordData
IN
OUT
*To invoke an RPG program that takes a Structure datatype as input or returns a Structure datatype as output, you also need to provide the meta-data information for this Structure data type.
For example, if your program (returnStructArray) returns one output parameter of array of Structure datatype, then the RecordMetaData looks like:
recordMetaData
recordMetaData[0]
DataName
"StructField"
DataType
"Structure"
DataLength
"10"
DataOccurs
5
For defining the StructField you need to define a Record List which looks like:
StructFieldMetaData
DataName
DataType
DataLength
DataOccurs
After execution, the record recordData contains the input fields, the output fields, and the corresponding values returned from the programs. In the above case, the recordData looks like:
recordData
StructField
StructField[0]
<Struct Member0> value
StructField[1]
<Struct Member1> value
StructField[n]
<Struct Membern> value