Kbase P27176: How to determine the busy status of a database using 4GL and the PROUTIL utility?
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  2/26/2008 |
|
Status: Verified
GOAL:
How to determine the busy status of a database using 4GL and the PROUTIL utility?
GOAL:
Sample use of the OS-COMMAND statement
FACT(s) (Environment):
Progress 8.x
Progress 9.x
All Supported Operating Systems
FIX:
/******************************************************************************/
/* The following code parses the output of the Progress utility PROUTIL.BAT */
/* to determine the busy status of the database and report whether the it is */
/* running in single user-mode, multi-user mode or not running at all */
/******************************************************************************/
DEFINE VARIABLE cTempFilename AS CHARACTER NO-UNDO.
DEFINE VARIABLE cOutputLine AS CHARACTER NO-UNDO.
DEFINE VARIABLE iNumberOfLines AS INTEGER NO-UNDO.
DEFINE VARIABLE cExecutableCommand AS CHARACTER NO-UNDO.
ASSIGN
cExecutableCommand = "c:\progress91d\bin\proutil c:\wrk91d\test -C busy > c:\wrk91d\TempFilename.txt"
cTempFilename = "c:\wrk91d\TempFilename.txt"
iNumberOfLines = 0.
OS-COMMAND SILENT VALUE(cExecutableCommand).
INPUT FROM VALUE( cTempFilename ) NO-ECHO.
REPEAT:
IMPORT UNFORMATTED cOutputLine.
ASSIGN
iNumberOfLines = iNumberOfLines + 1.
END.
IF iNumberOfLines = 1 THEN DO:
MESSAGE "The database is not running"
VIEW-AS ALERT-BOX INFO BUTTONS OK.
QUIT.
END.
IF iNumberOfLines = 2 THEN DO:
IF INDEX(cOutputLine, "single-user") > 0 THEN
MESSAGE "The database is in Single User Mode"
VIEW-AS ALERT-BOX INFO BUTTONS OK.
ELSE IF INDEX(cOutputLine, "multi-user") > 0 THEN
MESSAGE "The database is in Multi-User Mode"
VIEW-AS ALERT-BOX INFO BUTTONS OK.
ELSE
MESSAGE "Something is wrong!"
VIEW-AS ALERT-BOX INFO BUTTONS OK.
END.