PxPlus User Forum

Twitter Twitter Twitter

Author Topic: distinguish errors 0  (Read 1387 times)

Thomas Bock

  • Diamond Member
  • *****
  • Posts: 177
    • View Profile
distinguish errors 0
« on: August 30, 2018, 05:12:57 AM »
Accidently *optsel was called from a cron job, which caused an error 0 in line 260. Due to the nature of an error 0 our errorhandler tried to continue, which will never succeed.
The question is, if that error 0 can be dinstinguished somehow from an error 0 caused by lock/open/extract?

Mike King

  • Diamond Member
  • *****
  • Posts: 3811
  • Mike King
    • View Profile
    • BBSysco Consulting
Re: distinguish errors 0
« Reply #1 on: August 30, 2018, 08:47:01 AM »
The reporting of error 0, like many other error conditions, is based on the OS error code returned to PxPlus.  The most common OS error that will generate an error 0 is "Permissions Denied" which is all the OS tells is about the operation we performed.

In your case, you could test the value in RET or the contents of MSG(ret) to see if it can provide more details.

Another option is to use the value in STK(-1) within your error handler to obtain the line number where the error occured and then LST(PGM(stno, -1)) to get the actual line of code.

Mike King
President - BBSysco Consulting
eMail: mike.king@bbsysco.com