Consultor Eletrônico



Kbase P174829: 4GL/ABL: How to get the full path names of all the connected databases?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   08/10/2010
Status: Unverified

GOAL:

4GL/ABL: How to get the full path names of all the connected databases?

GOAL:

How to access the full path names of all the databases currently connected to the ABL/4GL session?

GOAL:

Is there a way to determine the full pathnames of all the connected databases?

GOAL:

How to compile the external called procedure that references the DICTDB ALIAS created in the calling procedure?

FACT(s) (Environment):

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

FIX:

To accomplish this task, you need two procedures, one to specify the currently selected or working database using the ALIAS DICTDB and the other to query the currently selected DICTDB database. In the following example, the procedure named:

GetFullPathNamesOfAllConnectedDatabases.p

loops through all the connected databases and makes each one, in turn, the currently selected or working database. It then calls the external procedure named:

GetCurrentlySelectedDatabaseFullPathName.p

which obtains the needed information from the currently selected database and returns it to the calling procedure:


/* GetFullPathNamesOfAllConnectedDatabases.p */
DEFINE VARIABLE iCount AS INTEGER NO-UNDO.
DEFINE VARIABLE Fullname AS CHARACTER NO-UNDO.
DO iCount = 1 TO NUM-DBS:
CREATE ALIAS DICTDB FOR DATABASE VALUE(LDBNAME(iCount)).
RUN GetCurrentlySelectedDatabaseFullPathName.p (OUTPUT fullname).
MESSAGE fullname
VIEW-AS ALERT-BOX INFO BUTTONS OK.
DELETE ALIAS DICTDB.
END.

/* GetCurrentlySelectedDatabaseFullPathName.p */
DEFINE OUTPUT PARAMETER cFullPathName AS CHARACTER.
FIND DICTDB._fileList WHERE DICTDB._fileList._fileList-Name MATCHES "*.db".
ASSIGN cFullPathName = DICTDB._fileList._fileList-Name.
Note:
The following steps compile the GetCurrentlySelectedDatabaseFullPathName.p procedure and generate its r-code file GetCurrentlySelectedDatabaseFullPathName.r. Although these steps assume a Windows platform, the same steps ( less the first one) may be followed to perform the task under UNIX/LINUX platforms:
1. Start a Proenv session: Start > Programs > OpenEdge > Proenv
2. Create an empty database named DICTDB using the command: prodb DICTDB empty
3. Opened a new Procedure Editor session connected to this database using the command: prowin32 DICTDB -1.
4. Execute the following line of code in the Procedure Editor: COMPILE GetCurrentlySelectedDatabaseFullPathName.p SAVE.