Behaviour inconsistency


[ Follow Ups ] [ Post Followup ] [ Signature.net Forum ]

Posted by Robert G Laurin on April 17, 2006 at 08:53:06:

I found a discrepancy on how the EXCP is handled for PREV( ) and KEY( ).

In many of my programs, I use the EXCPSUB to trap EOF and I found that KEY(lun,EXCPSUB=label) returns a null value.

That means I can easily code like this:

...
LET XKEY$ = KEY(Lun,EXCPSUB=ExcpRet)
IF XKEY$ = '' GOTO PRINT.REPORT.TOTALS
...
...
!
ExcpRet:
RETURN
!

This way I get rid of nearly all EXCP routine that do nothing for a living.

However if I code using the PREV( ) function, results is not so predictable...

...
LET XKEY$ = PREV(Lun,EXCPSUB=ExcpRet)
IF XKEY$ = '' GOTO REACH.TOP.OF.FILE
...
...
!
ExcpRet:
RETURN
!

Unfortunately, the PREV With and Exception 2 does return a value to XKEY$. This value seems to be whatever key was issued on the last valid KEY function OR THE LAST KEY EXPRESSION USED TO READ OR POSITION( ).

If I do this:

POSITION (lun) KEY='A' + 'B'
XKEY$ = ''
XKEY$ = PREV(lun,EXCPSUB=ExcpRet)

The value of XKEY$ will be 'AB' if there was en EXCP=2.

Ouch !!!

This was tested with Comet 2006.369 using the NLM. Will try this with CometServe soon.


Follow Ups:



Post a Followup

Name:
E-Mail:

Subject:

What is the name of the main Signature System's Product?

Comments:

Optional Link URL:
Link Title:
Optional Image URL:

You may attach up to 5 files to your followup (see below):






[ Follow Ups ] [ Post Followup ] [ Signature.net Forum ]