I want to trap and report back any error set in PxPlus to a calling program (DOS batch file in this case). This installation is a Windows Server 2012 with PxPlus 11.50 (base).
PxPlus is initiated in a batch file as follows:
echo off
echo We are in the batch file
echo Before: %errorlevel%
test.pxp
echo After: %errorlevel%
pause
My sample PxPlus program simply generates an error (Divide by zero)
0010 CLEAR
0020 SETERR 0080
0030 PRINT "Hello World..."
0050 LET A=2/0
0060 PRINT "ok..."
0065 WAIT 1
0070 END
0080 PRINT "oops..."
0081 LET %EXIT_CODE=1
0085 WAIT 1
0090 END
Removing line 20 make no difference for me in this case. Pxplus program will crash hard and return back to the batch file. In both cases the %errorlevel% variable is still set to 0.
The end game is to inform the batch file there was a problem with the PxPlus program. This is for an automated process and we're simply looking for a way to know if the test.pxp program generated an error or ran clean.
TIA, Bruno.