call "CBL_MANAGED_SESSION_GET_USERDATA" using by value user-dataname returning user-data.
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 C# program that calls the COBOL program from within a RunUnit:
using System; using MicroFocus.COBOL.RuntimeServices; class MainClass { public static void Main(string[] args) { RunUnit ru = new RunUnit(); try { ru.SetUserData("message","PASS: CBL_MANAGED_SESSION_GET_USER_DATA"); ru.Call("GetUserDataExample"); Console.WriteLine(ru.GetUserData("reply")); } finally { ru.StopRun(); } } }