Consultor Eletrônico



Kbase P134046: 4GL/ABL: How to programmatically determine from the name of a partition whether it is local or remot
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   07/08/2008
Status: Unverified

GOAL:

4GL/ABL: How to programmatically determine from the name of a partition whether it is local or remote without reading the contents of appsrvtt.d?

GOAL:

How to determine if a partition is local or remote without accessing the data records of AppSrv-TT TEMP-TABLE?

GOAL:

Sample user defined functions to determine whether a partition is local or remote.

FACT(s) (Environment):

All Supported Operating Systems
Progress 9.x
OpenEdge 10.x

FIX:

The following code demonstrates two functions to determine whether a partition is local or remote. Similar functions may be added to a customized version of adecomm/as_utils.w to avoid having to redefine the AppServ-TT TEMP-TABLE:
DEFINE TEMP-TABLE AppSrv-TT
FIELD Partition AS CHARACTER FORMAT "X(25)"
FIELD Host AS CHARACTER FORMAT "X(15)" /* NS -H parameter */
FIELD Service AS CHARACTER FORMAT "X(15)" /* NS -S parameter */
FIELD Configuration AS LOGICAL FORMAT "Remote/Local"
FIELD Security AS LOGICAL FORMAT "Prompt/No"
FIELD Info AS CHARACTER LABEL "AppServer Information"FORMAT "X(255)"
FIELD AS-Handle AS HANDLE /* Handle if connected */
FIELD App-Service AS CHARACTER LABEL "Application Service" FORMAT "X(25)"
FIELD Conn-Count AS INTEGER LABEL "Pseudo connections" INITIAL 0
FIELD PartitionType AS CHARACTER FORMAT "X(10)"
FIELD ServerURL AS CHARACTER FORMAT "X(255)"
INDEX Partition IS PRIMARY UNIQUE Partition
INDEX App-Service App-Service
INDEX PartitionType PartitionType.
DEFINE VARIABLE cPartitionName AS CHARACTER NO-UNDO.
FUNCTION isLocal RETURNS LOGICAL (INPUT ipcPartitionName AS CHARACTER) FORWARD.
FUNCTION isRemote RETURNS LOGICAL (INPUT ipcPartitionName AS CHARACTER) FORWARD.
CREATE AppSrv-TT.
ASSIGN
Partition = "myPartitionName"
Configuration = TRUE.
MESSAGE
isRemote( "myPartitionName") "~n"
isLocal( "myPartitionName")
VIEW-AS ALERT-BOX INFO BUTTONS OK.
FUNCTION isLocal RETURNS LOGICAL (INPUT ipcPartitionName AS CHARACTER):
RETURN
CAN-FIND(FIRST AppSrv-TT WHERE AppSrv-TT.Partition = ipcPartitionName NO-LOCK) AND
CAN-FIND(FIRST AppSrv-TT WHERE AppSrv-TT.Partition = ipcPartitionName AND NOT AppSrv-TT.Configuration NO-LOCK).
END FUNCTION.
FUNCTION isRemote RETURNS LOGICAL (INPUT ipcPartitionName AS CHARACTER):
RETURN
CAN-FIND(FIRST AppSrv-TT WHERE AppSrv-TT.Partition = ipcPartitionName NO-LOCK) AND
CAN-FIND(FIRST AppSrv-TT WHERE AppSrv-TT.Partition = ipcPartitionName AND AppSrv-TT.Configuration NO-LOCK).
END FUNCTION.