Kbase P85051: How to connect procedures to the AppServer using the partition names defined in the appsrvtt.d file.
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  21/06/2004 |
|
Status: Unverified
GOAL:
How to connect procedures to the AppServer using the partition names defined in the appsrvtt.d file. This method is used to connect the SDO's to the AppServer too.
GOAL:
How To Connect To the AppServer Using Partition
FIX:
There are two ways to connect the session to the AppServer:
a) Using the 4GL statements.
b) Using super-procedures already created by Progress Developers.
The following example shows how to connect to the server and run a
procedure in it:
DEFINE VARIABLE hServer AS HANDLE NO-UNDO.
DEFINE VARIABLE hProc AS HANDLE NO-UNDO.
DEFINE VARIABLE lOk AS LOGICAL NO-UNDO.
CREATE SERVER hServer.
lOK = hServer:CONNECT('-AppService sports2000 -H <host-name> -S NS1 -N
tcp') NO-ERROR.
IF NOT lOk THEN DO:
MESSAGE 'Cannot make connection to the server'.
QUIT.
END.
RUN myProc.p PERSISTENT SET hProc ON SERVER hServer.
MESSAGE DYNAMIC-FUNCTION('getValue' IN hProc).
In the example above, a server is created, the connection is
established, and the process is executed in the server handle.
However, if the application has SmartDataObjects, using this example a
new connection to the AppServer will be made. By specifying the
partition name as the SDO's do, it is possible to use the same SDO
partition to execute a process in the AppServer.
The Progress include file adecomm/appserv.i loads the
adecomm/as-utils.w file as super-procedure.
The as-utils.w super-procedure has the internal procedure
'appServerConnect' that checks that the partition name is connected to
the AppServer. If it is true, this procedure returns the server
handle, otherwise this procedure makes the connection to the AppServer
and returns its handle.
This next example shows how to use the adecomm/appserv.i file to do
connections using the partition names:
DEFINE VARIABLE hServer AS HANDLE NO-UNDO.
DEFINE VARIABLE hProc AS HANDLE NO-UNDO.
{adecomm/appserv.i}
RUN appServerConnect(INPUT 'sports2000', /*Partition name*/
INPUT ?, /*Security prompt*/
INPUT ?, /*AppServer info*/
OUTPUT hServer). /*Server handle*/
RUN myProc.p PERSISTENT SET hProc ON SERVER hServer.
MESSAGE DYNAMIC-FUNCTION('getValue' IN hProc).