Can anybody tell me where I can find a list of On-Error codes for the Monitor/EndMon block? I went to the Language Reference, used Google, etc, etc. I'm stumped! Specifically looking for divide by zero and result too large for the field, but would still be interested in the list for future use.
Announcement
Collapse
No announcement yet.
Monitor On-Error Codes
Collapse
X
-
Tags: None
-
Re: Monitor On-Error Codes
There are no "codes" per se' for the On-Error clause. That code just gets executed IF there is an error on the command being performed in the Monitor section. You program the response for finding an error. Whether it's Command Line execution or Divide by Zero or DDE doesn't really matter. That's the beauty of the statement.
-
Re: Monitor On-Error Codes
you have to wrap your own....
here is a list of some of the errors
Look for ==> Status codes *STATUS
example
PHP Code:d bigzero s 5 0
D dividebyzero c 00102
d charfield s 7
d count s 1 0
d decimalfield s 7 2
d mystatus s 5 0
/free
for count = 1 to 3;
select;
when count =1;
charfield = '0001222';
monitor;
decimalfield = %dec(charfield:7:2) ;
on-error;
mystatus = %status;
dsply %editc(mystatus:'X') ' ';
endmon;
when count =2;
charfield = '000ABCD';
monitor;
decimalfield = %dec(charfield:7:2) ;
on-error;
mystatus = %status;
dsply %editc(mystatus:'X') ' ';
endmon;
when count =3;
charfield = '12567';
monitor;
decimalfield = %dec(charfield:7:2) ;
decimalfield = decimalfield/bigzero;
on-error;
mystatus = %status;
dsply %editc(mystatus:'X') ' ';
endmon;
endsl;
endfor;
// monitor specifically for the devide by zeros code
monitor;
decimalfield = decimalfield/bigzero;
on-error dividebyzero;
decimalfield = *zeros;
dsply 'Hey! ShortBus you cant do that' ' ' ;
endmon;
*inlr = *on;
/end-free
All my answers were extracted from the "Big Dummy's Guide to the As400"
and I take no responsibility for any of them.
www.code400.com
Comment
-
Re: Monitor On-Error Codes
Status codes are documented in the RPG Reference Chapter 5 - File and Program Exception/Errors
You may also have a look into the message file QRNXMSG, Message-Ids RNX.
Remove RNX and voila you'll get the Status codes
RNX0102 = 'Divided by Zero'. RNX1218 = Record lock.
Birgitta
Comment
-
Re: Monitor On-Error Codes
Thanks everyone! Was especially trying to find 00102 (Divide by zero) and 00103 (An intermediate result is not large enough to contain the result) but the other codes as well. Jamie's link & Birgitta's trick (RNX Ids) also are a great resource. Code/400 to the rescue again!
Comment
Comment