Module class | QSYS API Reference Guide
Estimated reading time: 19 minutes
Defines the core behavior of classes that were migrated from RPG or CL programs and modules.
Namespace: ASNA.QSys.Runtime.JobSupport
Assembly: ASNA.QSys.Runtime.dll
Inheritance: Object
Constructors
Name |
Description |
Module(CommonProgram) |
Called from constructors in derived classes to initializes the Module class. |
Called from constructors in derived classes to initializes the Module class.
Parameters
Type |
Parameter name |
Description |
CommonProgram |
containerProgram |
The program containing the module. |
Properties
Methods
Signature |
Description |
Dispose(Boolean) |
Releases the resources used by the current instance of the Module class. This default implementation does nothing. |
EndModuleCall() |
Notifies the program that contains this module that the *ENTRY module call has ended. |
ExecOS400Command(String) |
Executes a command on the IBM i serving as the database server for the Job. |
ExecSQL_Query(Int32, DbConnection, String, DBParm[]) |
Execute an SQL Command producing a QueryResults. |
ExecSQL_Query(Int32, String, DBParm[]) |
Execute an SQL Command, on the default Job’s ado connection, producing a QueryResults. |
ExecSQL_Query(Int32, SqlPreparedStatement, DBParm[]) |
Execute an prepared SQL Command producing a QueryResults. |
ExecSQL_Statement(DbConnection, String, DBParm[]) |
Execute an non-query SQL Command. |
ExecSQL_Statement(String, DBParm[]) |
Execute an non-query SQL Command on the default Job’s ado connection. |
ExecSQL_Statement(SqlPreparedStatement, DBParm[]) |
Execute an non-query prepared SQL Command. |
FormatMessage(String, String, String, String&) |
Produces the strings with the formatted first and second level text for a message. Any placeholders are replaced with values from the message data. |
GetLdaField(Int32, Int32) |
Gets a value stored in the LDA. |
[GetModule()](#t-getmodule-t) |
Gets a module contained in the same program or in one of the service programs. |
PopInvocation() |
Pops one invocation from the invocation stack. |
PushInvocation() |
Pushes the caller procedure in the invocation stack. |
ReceiveMessage(Int32, String, MessageType, String, Boolean) |
Receive messages from the Program Queue. Messages are received in FIFO order. |
ReceiveMessage(String, MessageType, String, Boolean) |
Receive messages from the Program Queue. Messages are received in FIFO order. |
ReclaimActivationGroup(String) |
Reclaim the resources on the Job’s named activation group. |
ReclaimResources(Boolean) |
Reclaim the resources on the Job’s default activation group. |
RemoveMessage(String, String) |
Remove messages from the program queue entry. |
RemoveMessage(Int32, String, String) |
Remove messages from the Program Queue. |
RemoveMessage(String) |
Remove messages from *PRVious program called. |
SendExternalMessage(String, String, String, MessageType) |
Send a message to *EXTernal message queue. |
SendExternalMessage(String, MessageType) |
Send text message to *EXTernal message queue. |
SendProgramMessage(String, String, String, String, MessageType) |
Send message to program message entry queue in the invocation stack. |
SendProgramMessage(String, String, String, Int32, String, MessageType) |
Send message to program message queue in the invocation stack. |
SendProgramMessage(String, String, MessageType) |
Send text message to program message entry queue in the invocation stack. |
SendProgramMessage(String, Int32, String, MessageType) |
Send text message to program message queue in the invocation stack. |
SetLdaField(Int32, Int32, String) |
Stores a value in the LDA. |
Releases the resources used by the current instance of the Module class. This default implementation does nothing.
void Dispose(bool disposing)
Parameters
Type |
Parameter name |
Description |
Boolean |
disposing |
true to release managed and unmanaged resources; false to release only unmanaged resources. |
void EndModuleCall()
Notifies the program that contains this module that the *ENTRY module call has ended.
Executes a command on the IBM i serving as the database server for the Job.
void ExecOS400Command(string cmdText)
Parameters
Type |
Parameter name |
Description |
String |
cmdText |
The command to execute on the server. |
Execute an SQL Command producing a QueryResults.
QueryResults ExecSQL_Query(int expectedResults, DbConnection sqlConnection, string sqlText, DBParm[] parameters)
Parameters
Type |
Parameter name |
Description |
Int32 |
expectedResults |
The number of expected results. |
DbConnection |
sqlConnection |
An open connection to the server where the SQL command will execute. |
String |
sqlText |
The SQL command to execute. |
DBParm[] |
parameters |
An array of parameters to be used with the command. |
Returns
Type |
Description |
QueryResults |
The results produced by the server. |
Execute an SQL Command, on the default Job’s ado connection, producing a QueryResults.
QueryResults ExecSQL_Query(int expectedResults, string sqlText, DBParm[] parameters)
Parameters
Type |
Parameter name |
Description |
Int32 |
expectedResults |
The number of expected results. |
String |
sqlText |
The SQL command to execute. |
DBParm[] |
parameters |
An array of parameters to be used with the command. |
Returns
Type |
Description |
QueryResults |
The results produced by the server. |
Execute an prepared SQL Command producing a QueryResults.
QueryResults ExecSQL_Query(int expectedResults, SqlPreparedStatement preparedStatement, DBParm[] parameters)
Parameters
Type |
Parameter name |
Description |
Int32 |
expectedResults |
The number of expected results. |
SqlPreparedStatement |
preparedStatement |
The prepared SQL command to execute. |
DBParm[] |
parameters |
An array of parameters to be used with the command. |
Returns
Type |
Description |
QueryResults |
The results produced by the server. |
Execute an non-query SQL Command.
void ExecSQL_Statement(DbConnection sqlConnection, string sqlText, DBParm[] parameters)
Parameters
Type |
Parameter name |
Description |
DbConnection |
sqlConnection |
An open connection to the server where the SQL command will execute. |
String |
sqlText |
The SQL command to execute. |
DBParm[] |
parameters |
An array of parameters to be used with the command. |
Execute an non-query SQL Command on the default Job’s ado connection.
void ExecSQL_Statement(string sqlText, DBParm[] parameters)
Parameters
Type |
Parameter name |
Description |
String |
sqlText |
The SQL command to execute. |
DBParm[] |
parameters |
An array of parameters to be used with the command. |
Execute an non-query prepared SQL Command.
void ExecSQL_Statement(SqlPreparedStatement preparedStatement, DBParm[] parameters)
Parameters
Type |
Parameter name |
Description |
SqlPreparedStatement |
preparedStatement |
The prepared SQL command to execute. |
DBParm[] |
parameters |
An array of parameters to be used with the command. |
Produces the strings with the formatted first and second level text for a message. Any placeholders are replaced with values from the message data.
string FormatMessage(string MsgFile, string MsgId, string MsgData, String& secondLevelText)
Parameters
Type |
Parameter name |
Description |
String |
MsgFile |
The message file name where the message description is to be found. |
String |
MsgId |
The message identification. |
String |
MsgData |
The replacement text, if any, for the message placeholders. |
String& |
secondLevelText |
The formatted second level text of the message. |
Returns
Type |
Description |
String |
The formatted first level text of the message. |
Gets a value stored in the LDA.
string GetLdaField(int start, int length)
Parameters
Type |
Parameter name |
Description |
Int32 |
start |
The one-based index into the location within the LDA where the value is stored. |
Int32 |
length |
The length in characters of the value to retrieve. |
Returns
Type |
Description |
String |
The requested field value. |
T GetModule()
Gets a module contained in the same program or in one of the service programs.
void PopInvocation()
Pops one invocation from the invocation stack.
void PushInvocation()
Pushes the caller procedure in the invocation stack.
Receive messages from the Program Queue. Messages are received in FIFO order.
Message ReceiveMessage(int stackPosition, string stackName, MessageType MsgType, string MsgKey, bool Remove)
Parameters
Type |
Parameter name |
Description |
Int32 |
stackPosition |
Relative position from the stackName starting at 0. |
String |
stackName |
Name of Program or Procedure in the stack. |
MessageType |
MsgType |
Type of message to receive. Use Any if type is indifferent. |
String |
MsgKey |
The message to remove. Use null if key is indifferent. |
Boolean |
Remove |
true to remove the message from the queue. |
Returns
Type |
Description |
Message |
The message specified or null if the message was not found in the queue. |
Receive messages from the Program Queue. Messages are received in FIFO order.
Message ReceiveMessage(string pgmQ, MessageType MsgType, string MsgKey, bool Remove)
Parameters
Type |
Parameter name |
Description |
String |
pgmQ |
The description of the program queue entry in the invocation stack. Composed of optional relative position (one of: *SAME, *PRV, number) and a procedure name (Use * for current procedure). |
MessageType |
MsgType |
Type of message to receive. Use Any if type is indifferent. |
String |
MsgKey |
The message to Remove. Use null if key is indifferent. |
Boolean |
Remove |
true to Remove the message from the queue. |
Returns
Type |
Description |
Message |
The message specified or null if the message was not found in the queue. |
Reclaim the resources on the Job’s named activation group.
void ReclaimActivationGroup(string groupName)
Parameters
Type |
Parameter name |
Description |
String |
groupName |
Name of the activation group. |
void ReclaimResources(bool caller)
Reclaim the resources on the Job’s default activation group.
void ReclaimResources(bool caller)
Parameters
Type |
Parameter name |
Description |
Boolean |
caller |
true to include the resource of the module’s program making this call; otherwise, false. |
Remove messages from the program queue entry.
void RemoveMessage(string pgmQ, string messageKey)
Parameters
Type |
Parameter name |
Description |
String |
pgmQ |
The description of the program queue entry in the invocation stack. Composed of optional relative position (one of: *SAME, *PRV, number) and a procedure name (Use * for current procedure). |
String |
messageKey |
The message to remove. It should always be “*ALL”. |
Remove messages from the Program Queue.
void RemoveMessage(int stackPosition, string stackName, string messageKey)
Parameters
Type |
Parameter name |
Description |
Int32 |
stackPosition |
Relative position from the stackName starting at 0. |
String |
stackName |
Name of Program or Procedure in the stack. |
String |
messageKey |
The message to remove. It should always be “*ALL”. |
Remove messages from *PRVious program called.
void RemoveMessage(string messageKey)
Parameters
Type |
Parameter name |
Description |
String |
messageKey |
The message to remove. It should always be “*ALL”. |
Send a message to *EXTernal message queue.
string SendExternalMessage(string MsgId, string MsgFileName, string MsgData, MessageType MsgType)
Parameters
Type |
Parameter name |
Description |
String |
MsgId |
The message identification. |
String |
MsgData |
The replacement text, if any, for the message placeholders. |
String |
MsgFileName |
The message file name where the message description is to be found. |
MessageType |
MsgType |
One of the enumeration values that specifies the severity of the message. |
Returns
Type |
Description |
String |
The message key. |
Send text message to *EXTernal message queue.
string SendExternalMessage(string MsgText, MessageType MsgType)
Parameters
Type |
Parameter name |
Description |
String |
MsgText |
The user provide text of the message. |
MessageType |
MsgType |
One of the enumeration values that specifies the severity of the message. |
Returns
Type |
Description |
String |
The message key. |
Send message to program message entry queue in the invocation stack.
string SendProgramMessage(string MsgId, string MsgFileName, string MsgData, string pgmQ, MessageType MsgType)
Parameters
Type |
Parameter name |
Description |
String |
MsgId |
The message identification. |
String |
MsgData |
The replacement text, if any, for the message placeholders. |
String |
MsgFileName |
The message file name where the message description is to be found. |
String |
pgmQ |
The description of the program queue entry in the invocation stack. Composed of optional relative position (one of: *SAME, *PRV, number) and a procedure name (Use * for current procedure). |
MessageType |
MsgType |
One of the enumeration values that specifies the severity of the message. |
Returns
Type |
Description |
String |
The message key. |
Send message to program message queue in the invocation stack.
string SendProgramMessage(string MsgId, string MsgFileName, string MsgData, int stackPosition, string stackName, MessageType MsgType)
Parameters
Type |
Parameter name |
Description |
String |
MsgId |
The message identification. |
String |
MsgData |
The replacement text, if any, for the message placeholders. |
String |
MsgFileName |
The message file name where the message description is to be found. |
Int32 |
stackPosition |
Relative position from the stackName starting at 0. |
String |
stackName |
Name of Program or Procedure in the stack. |
MessageType |
MsgType |
One of the enumeration values that specifies the severity of the message. |
Returns
Type |
Description |
String |
The message key. |
Send text message to program message entry queue in the invocation stack.
string SendProgramMessage(string MsgText, string pgmQ, MessageType MsgType)
Parameters
Type |
Parameter name |
Description |
String |
MsgText |
The user provide text of the message. |
String |
pgmQ |
The description of the program queue entry in the invocation stack. Composed of optional relative position (one of: *SAME, *PRV, number) and a procedure name (Use * for current procedure). |
MessageType |
MsgType |
One of the enumeration values that specifies the severity of the message. |
Returns
Type |
Description |
String |
The message key. |
Send text message to program message queue in the invocation stack.
string SendProgramMessage(string MsgText, int stackPosition, string stackName, MessageType MsgType)
Parameters
Type |
Parameter name |
Description |
String |
MsgText |
The user provide text of the message. |
Int32 |
stackPosition |
Relative position from the stackName starting at 0. |
String |
stackName |
Name of Program or Procedure in the stack. |
MessageType |
MsgType |
One of the enumeration values that specifies the severity of the message. |
Returns
Type |
Description |
String |
The message key. |
Stores a value in the LDA.
void SetLdaField(int start, int length, string newValue)
Parameters
Type |
Parameter name |
Description |
Int32 |
start |
The one-based index into the location within the LDA where newValue will be stored. |
Int32 |
length |
The length in characters of the value to store. |
String |
newValue |
The string value to store in the LDA. |