This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== Errorlevels ====== When PCBoard exits to DOS, it will set an errorlevel based on why it exited to DOS. Using DOS batch commands, you may check the errorlevel that is returned from the program that was last run and take appropriate actions. ===== Checking An Errorlevel ===== To test an errorlevel you need to use the IF batch file command. If you were to insert the following line somewhere after the PCBOARD line in your BOARD.BAT IF ERRORLEVEL 0 ECHO No Errors the message No Errors will be printed to the screen if PCBoard exits with an errorlevel of 0. For additional information on checking errorlevels, refer to your DOS manual. **NOTE:** Due to the way DOS errorlevels, you should check for higher numbered errorlevels first before checking lower errorlevels. PCBoard may exit with an errorlevel HIGHER than 7, yet DOS will treat an IF ERRORLEVEL 7 as being true. Therefore, if you will be using FAX software you should probably write your batch file like this: pcboard if errorlevel 8 board <-- test for all higher levels if errorlevel 7 fax <-- if 7 is still found, run fax ... etc ===== Errorlevel 0 ===== This errrorlevel will be returned anytime that PCBoard exits to DOS and expects no other action to take place. The only time that this will really occur is by selecting DOS - Busy or DOS - Not Busy from the call waiting screen. ===== Errorlevel 1 ===== This errorlevel will be returned if PCBoard is exiting to run an event. At this point, the door batch file has been copied to EVENT.BAT in the current directory. The BOARD.BAT that is included with you package uses an if exist event.bat line to determine when the event should be run instead of testing the errorlevel. ===== Errorlevel 2 ===== This errorlevel will be returned if PCBoard is exiting to run a door. At this point, the event file has been copied to DOOR.BAT in the current directory. The BOARD.BAT that is included with you package uses an if exist door.bat line to determine when a door should be run instead of testing the errorlevel. ===== Errorlevel 3 ===== This errorlevel will be returned if PCBoard is exiting to run a door. At this point, the REMOTE.SYS file has been copied to REMOTE.BAT in the current directory. The BOARD.BAT that is included with you package uses an if exist remote.bat line to determine when REMOTE.BAT should be run instead of testing the errorlevel. ===== Errorlevel 4 ===== This errorlevel is no longer used by PCBoard. ===== Errorlevel 5 ===== If you have answered Y to the Exit to DOS After Each Call option in PCBSetup > Configuration Options > Switches, PCBoard will exit with this errorlevel after each disconnect. By adding a line to your BOARD.BAT that tests for this errorlevel, you can determine the difference between a caller disconnecting and exiting via DOS - Busy or DOS - Not busy on the call waiting screen. The following BOARD.BAT shows an example of what your BOARD.BAT might look like after you have added the ability to test for errorlevel 5: @echo off c: cd\pcb set PCB= set dszlog=pcbdsz.log if exist remote.bat rename remote.bat remote.sys if exist door.bat del door.bat if exist endpcb del endpcb pcboard if errorlevel 99 board if errorlevel 5 loggedof.bat if exist remote.bat remote if exist door.bat door if exist event.bat event if exist endpcb goto end board :end Two lines have been added in this example. The first line checks for critical errors while the second checks to see if the caller disconnected. If the caller has disconnected, a batch file called LOGGEDOF.BAT will be executed. ===== Errorlevel 6 ===== If PCBoard is exiting because the node was marked to be recycled, this errorlevel will be returned. In your BOARD.BAT, you can add a statement which checks to see if the node is recycling. If so, run a batch file which does some special processing. The following illustrates the change that would need to be made to BOARD.BAT: @echo off c: cd\pcb set PCB= set dszlog=pcbdsz.log if exist remote.bat rename remote.bat remote.sys if exist door.bat del door.bat if exist endpcb del endpcb pcboard if errorlevel 99 board if errorlevel 6 call c:\update.bat if exist remote.bat remote if exist door.bat door if exist event.bat event if exist endpcb goto end board :end The two lines that were added to the batch file are highlighted in bold. The first line checks to see if the errorlevel returned by PCBoard is 99. If so, a critical error has occurred and this line will cause BOARD.BAT to be run again. If a critical error did not occur, the second line will run UPDATE.BAT found in the root directory of drive C. Notice that the call batch command is used. This will make sure that control is returned back to PCBoard after the UPDATE.BAT runs. For more information on the call command, refer to your DOS manual. ===== Errorlevel 7 ===== If PCBoard answers the call and the modem returns FAX or +FCON instead of CONNECT or CARRIER, PCBoard will immediately exit with an errorlevel of 7. A simple check for this errorlevel in your BOARD.BAT will tell you if you need to load your fax software of not. A modified BOARD.BAT may resemble the following: @echo off c: cd\pcb set PCB= set dszlog=pcbdsz.log if exist remote.bat rename remote.bat remote.sys if exist door.bat del door.bat if exist endpcb del endpcb pcboard if errorlevel 99 board if errorlevel 7 c:\fax\recvfax [params] if exist remote.bat remote if exist door.bat door if exist event.bat event if exist endpcb goto end board :end Notice that two lines were added to the batch file. The first checks to see if PCBoard exited due to an errorlevel of 99 while the second checks to see if a FAX call has been detected. You should be aware that the fax connection has already been established. You should use a program to receive the fax that assumes the connection has already been made. Refer to your modem manual to see if such a utility was shipped with your modem. **NOTE:** Modems which require TSR software to be loaded ahead of PCBoard, and which do not let PCBoard control the answering of the call, are a risk to PCBoard's security and are not supported. In addition, modems that do not issue a FAX or +FCON message are not currently supported. ===== Errorlevel 99 ===== If PCBoard is unable to load because a critical error has been detected, it will exit with this errorlevel. For a list of messages that will be printed by PCBoard if it is unable to load, refer to the Trouble Shooting section of this chapter. Each message is thoroughly explained.