To call a coroutine using the methods of external classes, perform the following:
Create an external class in the model. The name can be any ABS legal name.
During migration, an external class is created in the model with the name concatenated from the library path, pack name and usercode, and this class is prefixed with 'CoRoutine_" and postfixed with "_Lib". For example, a class named CoRoutine_SYS2_REPORT2_PACK_X_USER_Z_Lib.
Set the following configuration property for the external class:
Set Library Name to the report name.
Set the Library Pack to pack name.
Set the Library Usercode to usercode.
Set the As Coroutine to True.
Add a method to CoRoutine class called report.
Add a method to CoRoutine class called report.
Call the couroutine using the following code.
CoRoutine_Lib.<report>(GLB.PARAM)
Transaction recovery strategies should consider that a coroutine called from an Ispec is a separate DMSII transaction from that Ispec's transaction.
Note: If you use Glb.Param in CALL; commands between applications, the maximum size of Glb.Param defined in the calling application and the called application must be the same.
Example of Calling a Coroutine from Logic
The following logic is an example of calling a Coroutine.
Prerequisite:
An attribute PARAM_GROUP is created with the stereotype 'Group'.
Note: If you are calling the coroutine from within the same application it is defined in, you could create a simple attribute which inherits from the PARAM_GROUP which you have defined as the interface for the coroutine.
A String attribute S_FUNC with length 5 is added as a member of PARAM_GROUP.
A String attribute S_NAME length 20 is added as a member of PARAM_GROUP.
A String attribute S_STATUS length 5 is added as a member of PARAM_GROUP.
In the logic where you want to call the coroutine you have the following logic:
Move "READ" S_FUNC Move "SMITH" SNAME TheCoroutine.report( PARAM_GROUP ) DoWhen GLB.CORSTATUS = GLB.SPACES Else Message GLB.CORSTATUS "Coroutine invocation has given an error" EndExit Move GLB.PARAM PARAM_GROUP DoWhen S_STATUS = "*****" Message Error "Record doesn’t exist in database" EndExit