[BR_forum] Reseting ERR

General development discussion.

Moderators: Susan Smith, admin, Gabriel

Post Reply
Mikhail Zheleznov

[BR_forum] Reseting ERR

Post by Mikhail Zheleznov »

If a NOKEY is encountered in a READ statement, then ERR is set 4272.

How do I reset ERR?
George Tisdale

[BR_forum] Reseting ERR

Post by George Tisdale »

Force it to another error that you specifically trap. Gabriel uses zero divide

Let x=1/0 error zdiv
Zdiv:continue

George L. Tisdale, CPA
Tisdale CPA
75 Junction Square Drive
Concord, MA 01742
(978) 369-5585
IRS Circular 230 Notice: "To ensure compliance with requirements imposed by the IRS, we inform you that any U.S. tax advice contained in this communication (including any attachments) is not intended or written to be used, and cannot be used, for the purpose of (i) avoiding penalties under the Internal Revenue Code or (ii) promoting, marketing or recommending to another party any transaction or matter addressed herein."
This electronic message transmission contains information which is intended only for the use of the individual or entity to which it is addressed and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination or distribution of this communication to other than the intended recipient is strictly prohibited. If you have received this communication in error, please notify us immediately by calling (978) 369-5585 or by electronic mail (gtisdale@tisdalecpa.com) Thank you.

From: br_forum-bounces@ads.net [mailto:br_forum-bounces@ads.net] On Behalf Of Mikhail Zheleznov
Sent: Monday, May 11, 2009 5:27 PM
To: Business Rules Forum
Subject: [BR_forum] Reseting ERR


If a NOKEY is encountered in a READ statement, then ERR is set 4272.

How do I reset ERR?
Mikhail Zheleznov

[BR_forum] Reseting ERR

Post by Mikhail Zheleznov »

Thanks, George!

2009/5/11 George Tisdale <GTISDALE@tisdalecpa.com (GTISDALE@tisdalecpa.com)>

Force it to another error that you specifically trap. Gabriel uses zero divide
 
Let x=1/0 error zdiv
Zdiv:continue
 
George L. Tisdale, CPA
Tisdale CPA
75 Junction Square Drive
Concord, MA  01742
(978) 369-5585
IRS Circular 230 Notice: "To ensure compliance with requirements imposed by the IRS, we inform you that any U.S. tax advice contained in this communication (including any attachments) is not intended or written to be used, and cannot be used, for the purpose of (i) avoiding penalties under the Internal Revenue Code or (ii) promoting, marketing or recommending to another party any transaction or matter addressed herein."
This electronic message transmission contains information which is intended only for the use of the individual or entity to which it is addressed and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination or distribution of this communication to other than the intended recipient is strictly prohibited. If you have received this communication in error, please notify us immediately by calling (978) 369-5585 or by electronic mail (gtisdale@tisdalecpa.com (gtisdale@tisdalecpa.com)) Thank you.
 
From: br_forum-bounces@ads.net (br_forum-bounces@ads.net) [mailto:br_forum-bounces@ads.net (br_forum-bounces@ads.net)] On Behalf Of Mikhail Zheleznov
Sent: Monday, May 11, 2009 5:27 PM
To: Business Rules Forum
Subject: [BR_forum] Reseting ERR

 
If a NOKEY is encountered in a READ statement, then ERR is set 4272.

How do I reset ERR?



_______________________________________________
BR_forum mailing list
BR_forum@ads.net (BR_forum@ads.net)
http://ads.net/mailman/listinfo/br_forum_ads.net
Gabriel
Posts: 412
Joined: Sun Aug 10, 2008 7:37 am
Location: Arlington, TX
Contact:

[BR_forum] Reseting ERR

Post by Gabriel »

Mikhail,
 
I do use this teqnique whenever I have to, because sometimes its necessary. However, it makes for fragile and confusing code. Its much better to use the specific error trap routine to do this:
 
READ #1, using form$(1) : mat f$, mat f nokey TestNoKeyError
...
...
TestNoKeyError: ! Have your code for this error here.


Or, actually, here's an even better way:
 
READ #1, using form$(1) : mat f$, mat f nokey Ignore
if File(1)<>0 then
   ... handle your nokey error here
   ...
   ...
end if
 
See, using the FILE function returns the last error recieved with that file. You don't have to reset it because it resets automatically each time the file is read. The dirty work is done for you.
 
Gabriel
 
 
 
 
 
On Mon, May 11, 2009 at 4:46 PM, Mikhail Zheleznov <zheleznovster@gmail.com (zheleznovster@gmail.com)> wrote:
Thanks, George!

2009/5/11 George Tisdale <GTISDALE@tisdalecpa.com (GTISDALE@tisdalecpa.com)>


Force it to another error that you specifically trap. Gabriel uses zero divide
 
Let x=1/0 error zdiv
Zdiv:continue
 
George L. Tisdale, CPA
Tisdale CPA
75 Junction Square Drive
Concord, MA  01742
(978) 369-5585
IRS Circular 230 Notice: "To ensure compliance with requirements imposed by the IRS, we inform you that any U.S. tax advice contained in this communication (including any attachments) is not intended or written to be used, and cannot be used, for the purpose of (i) avoiding penalties under the Internal Revenue Code or (ii) promoting, marketing or recommending to another party any transaction or matter addressed herein."
This electronic message transmission contains information which is intended only for the use of the individual or entity to which it is addressed and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination or distribution of this communication to other than the intended recipient is strictly prohibited. If you have received this communication in error, please notify us immediately by calling (978) 369-5585 or by electronic mail (gtisdale@tisdalecpa.com (gtisdale@tisdalecpa.com)) Thank you.
 
From: br_forum-bounces@ads.net (br_forum-bounces@ads.net) [mailto:br_forum-bounces@ads.net (br_forum-bounces@ads.net)] On Behalf Of Mikhail Zheleznov
Sent: Monday, May 11, 2009 5:27 PM
To: Business Rules Forum
Subject: [BR_forum] Reseting ERR

 
If a NOKEY is encountered in a READ statement, then ERR is set 4272.

How do I reset ERR?





_______________________________________________
BR_forum mailing list
BR_forum@ads.net (BR_forum@ads.net)
http://ads.net/mailman/listinfo/br_forum_ads.net

_______________________________________________
BR_forum mailing list
BR_forum@ads.net (BR_forum@ads.net)
http://ads.net/mailman/listinfo/br_forum_ads.net
Mikhail Zheleznov

[BR_forum] Reseting ERR

Post by Mikhail Zheleznov »

Wouldn't   FILE(1)<> 0 be true in other cases as well, and not only if there is a NOKEY?

I think FILE returns

-1File not opened. 0Operation performed successfully. 10End of file occurred during input. 11End of file occurred during output. 20Transmission error during input. 21Transmission error during output.

And NONE of these values is used specifically for NOKEY, at least not according to the documentation I'm looking at.
John
Posts: 555
Joined: Sun Apr 26, 2009 8:27 am

[BR_forum] Reseting ERR

Post by John »

if file(1)=11 and err=4272  i believe should test specivically for nokey



On Tue, May 12, 2009 at 4:17 PM, Mikhail Zheleznov <zheleznovster@gmail.com (zheleznovster@gmail.com)> wrote:
Wouldn't   FILE(1)<> 0 be true in other cases as well, and not only if there is a NOKEY?

I think FILE returns

-1File not opened. 0Operation performed successfully. 10End of file occurred during input. 11End of file occurred during output. 20Transmission error during input. 21Transmission error during output.

And NONE of these values is used specifically for NOKEY, at least not according to the documentation I'm looking at.
_______________________________________________
BR_forum mailing list
BR_forum@ads.net (BR_forum@ads.net)
http://ads.net/mailman/listinfo/br_forum_ads.net
John Bowman
Gabriel
Posts: 412
Joined: Sun Aug 10, 2008 7:37 am
Location: Arlington, TX
Contact:

[BR_forum] Reseting ERR

Post by Gabriel »

Yes, File(1) will be 10 if there is a nokey. But I find that I generally want to do the same thing (ie, stop reading) no matter what file(1) is. If file(1) is 0, I read, if not, i don't read.
 
 
If you want to make sure you are testing for NOKEY, then still, don't use ERR. Its messy and unreliable.
 
Instead, use the NOKEY error condition.
 
READ #1, using form$(1) : mat f$, mat f NOKEY HandleNokeyError
 
Then, later you have a line somewhere called HandleNoKeyError
 
HandleNoKeyError: ! Handle the error here
...
...
continue ! or retry or whatever you want  to do
 
 
Does this help?
 
Gabriel


On Tue, May 12, 2009 at 3:17 PM, Mikhail Zheleznov <zheleznovster@gmail.com (zheleznovster@gmail.com)> wrote:
Wouldn't   FILE(1)<> 0 be true in other cases as well, and not only if there is a NOKEY?

I think FILE returns

-1 File not opened. 0 Operation performed successfully. 10 End of file occurred during input. 11 End of file occurred during output. 20 Transmission error during input. 21 Transmission error during output.

And NONE of these values is used specifically for NOKEY, at least not according to the documentation I'm looking at.
_______________________________________________
BR_forum mailing list
BR_forum@ads.net (BR_forum@ads.net)
http://ads.net/mailman/listinfo/br_forum_ads.net
Post Reply