5.41.2 Using the AxesTerminalService
Whether you are writing your client application in RDML / RDMLX or in a 3GL such as RPG, you have to complete the same basic steps.
For example, the simplest application that connects to an aXes Terminal Server to fill one screen value and send ("enter") would typically issue the following sequence of service commands:
JSM(X)_OPENJSM(X)_COMMANDs
SERVICE_LOAD
CONNECT
SETBYNAME
SEND
DISCONNECT
SERVICE_UNLOAD
JSM(X)_CLOSE
Refer to the Java Service Manager Clients for the command details that apply to your chosen development language.
Return variablesNote that the AxesTerminalService commands make extensive use of client program variables named in command keywords to return variable information to the client program. Such command keywords have names beginning with 'RTN'.
For example, to retrieve the value of a field on the current 5250 screen by reference to its screen row and column numbers and place the result in the client program variable named MYVALUE, a LANSA RDMLX client application might contain code like this:
define field(#myvalue) reffld(#std_text)
#jsmcommand := 'getbypos row(10) col(44) rtnvalue(MYVALUE) SERVICE_EXCHANGE(*FIELD)'
use builtin(jsmx_command) with_args(#jsmhandle #jsmcommand) to_get(#jsmstatus #jsmmessage)
if (#myvalue = 'XYZ')
...
endif
In this example, the presence of SERVICE_EXCHANGE(*FIELD) in the JSM service command string is essential in order to exchange the program's variables with the service and permits the service to address the variables to return the requested values.
If you omit the SERVICE_EXCHANGE(*FIELD) from the JSM command, the service will not have access to the named variable and the program will not receive the value.
Notes:
1. Where necessary, SERVICE_EXCHANGE(*FIELD) must be specified in uppercase exactly as shown.
2. This is a simplified description. There are other means to accomplish the exchange of program variables between the client application and the JSM service.