Kbase P122428: How to return a code error when quitting Progress on Windows
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  22/02/2007 |
|
Status: Unverified
GOAL:
How to return a code error when quitting Progress on Windows
GOAL:
How to trap the code error returned by a Progress program launched in batch mode
FACT(s) (Environment):
Windows
FIX:
This is not possible to achieve it from Progress ABL.
However, this can be achieved by using the exitProcess Windows API.
Before calling this API, it is recommended to disconnect to the database, otherwise the following message will appear in the database log file:
Usernum 23 terminated abnormally. (794)
Note:
If the program contains temp-tables, the temporary files will not be automatically deleted.
ABL example:
/* RunMe.p sample program */
PROCEDURE ExitProcess EXTERNAL "kernel32":
DEFINE INPUT PARAMETER uExitCode As LONG.
END PROCEDURE.
/* Disconnect to the sports database */
DISCONNECT sports.
/* Exit the _progres process and return the code 50 */
RUN exitProcess(INPUT 50).
.bat file:
echo off
_progres -b -p RunMe.p -pf mypf.pf
IF errorlevel 100 goto 100
IF errorlevel 50 goto 50
echo exit code is 0
goto done
:100
echo exit code is 100
goto done
:50
echo exit code is 50
:done
echo done