Kbase P47634: how to use holder parameter
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  10/16/2008 |
|
Status: Unverified
GOAL:
How To Access PROUTIL's HOLDER Return Codes from DOS and 4GL
FIX:
SUMMARY:
When the PROUTIL command completes with the HOLDER qualifier, it
returns a code that you can test, in a UNIX script or Windows batch
file, to determine the status of the database.
The Progress Database Administration Guide and Reference provides a
UNIX script example demonstrating the capture of these return codes.
This Solution provides a DOS batch file example showing how to access
these return codes from the DOS command line, as well as a procedure
showing how to access them from 4GL.
EXPLANATION:
The return codes for the HOLDER qualifier are:
0 If the Database is not in use,
14 IF the Database is locked by a single user, PROUTIL,
or RFUTIL, and
16 If the Database is open in multi-user mode.
SOLUTION:
-- Accessing the return codes from the DOS command line:
1) Cut, paste, and save the following batch file as "DBHolder.bat"
@echo off
_proutil d:\wrk91c\sports2000 -C holder
if errorlevel 16 goto multiuser
if errorlevel 14 goto singleuser
if errorlevel 0 goto notinuse
goto end
:multiuser
echo Database is open in multi-user mode
goto end
:singleuser
echo Database is locked by single user, PROUTIL, or RFUTIL
goto end
:notinuse
echo Database is not in use
goto end
:end
2) Type DBHolder from the DOS command line and hit return.
NOTE: Make sure that %DLC%\bin is in your DOS session's PATH.
-- Accessing the return codes from a 4GL procedure:
1) Cut, paste, and save the following batch file as "DBStatus.bat".
@echo off
_proutil d:\wrk91c\sports2000 -C holder
echo %errorlevel% > TempFilename.txt
2) Run the following 4GL procedure:
DEFINE VARIABLE cTempFilename AS CHARACTER NO-UNDO.
DEFINE VARIABLE cOutputLine AS CHARACTER NO-UNDO.
DEFINE VARIABLE cExecutableCommand AS CHARACTER NO-UNDO.
ASSIGN
cExecutableCommand = "DBStatus.bat"
cTempFilename = "TempFilename.txt".
OS-COMMAND SILENT VALUE(cExecutableCommand).
INPUT FROM VALUE( cTempFilename ) NO-ECHO.
IMPORT UNFORMATTED cOutputLine.
IF cOutputLine = "16" THEN
MESSAGE "Database is open in multi-user mode"
VIEW-AS ALERT-BOX INFO BUTTONS OK.
IF cOutputLine = "14" THEN
MESSAGE "Database is locked by single user, PROUTIL, or RFUTIL"
VIEW-AS ALERT-BOX INFO BUTTONS OK.
IF cOutputLine = "0" THEN
MESSAGE "Database is not in use"
VIEW-AS ALERT-BOX INFO BUTTONS OK.
NOTE: Make sure that %DLC%\bin is in your Progress Session's PROPATH.
References to Written Documentation:
Progress Database Administration Guide and Reference