call "CBL_MANAGED_SESSION_SET_USERDATA" using by value user-dataname
by value user-data.
None.
The following example demonstrates the use of CBL_MANAGED_SESSION_GET_USERDATA and CBL_MANAGED_SESSION_SET_USERDATA from within a RunUnit.
The COBOL program that utilizes the library routines:
program-id. "GetUserDataExample".
procedure division.
*> retrieves a user data object called message from the
*> current rununit
declare msg as string
call "CBL_MANAGED_SESSION_GET_USERDATA" using
by value "message"
returning msg
end-call.
*> creates a new user data object that contains the
*> original object "OK"
set msg to msg & " - OK"
call "CBL_MANAGED_SESSION_SET_USERDATA" using
by value "reply"
by value msg
end-call.
goback.
And the Java program that calls the COBOL program from within a RunUnit:
import com.microfocus.cobol.runtimeservices.*;
class demoUserData {
public static void main(String[] args) {
RunUnit ru = new RunUnit();
try
{
ru.SetUserData("message","PASS: CBL_MANAGED_SESSION_GET_USER_DATA");
ru.Call("GetUserDataExample");
System.out.println(ru.GetUserData("reply"));
}
finally
{
ru.StopRun();
}
}
}