Error when deleting the last record out of a file
Mike Schwartz
mschw at athenet.net
Sun Dec 16 14:11:38 PST 2007
> From: Jay R. Ashworth
>
> On Fri, Dec 14, 2007 at 09:25:37AM -0600, Mike Schwartz wrote:
> > Yes, I was having another senior "duh" moment. It's become so
> automatic
> > over the past 30+ years to use the "-b" option and then do all the
> error
> > handling myself, after I pretend a lookup has succeeded, that, late
> in the
> > day, it didn't dawn on me to try the "-n" flag.
>
> I'm curious: if you hide the failure of the lookup with -b, how *can*
> you "do error handling yourself": you don't *know* there was an error.
>
If there isn't any data in a "must fill" field in the record you look
up, then you know the lookup failed to return a valid record.
For example, if you are confident that every record in a lookup file has
a social security number in field #1, and the record you looked up returns a
blank social security in field #1, then you know the lookup failed. In most
cases, this saves you writing 1 or more lines of code, and also allows
processing to continue in a linear fashion, without a goto on the "not
lkpfile" and without writing any additional error handling.
Mike Schwartz
More information about the Filepro-list
mailing list