× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



CarollaT@xxxxxxxxxxxxxx wrote:
Greetings!

I have started using some exception/error handling techniques (due in part
to the scolding by Mr. Tuohy in his class ;-) ), and I have run into a
slight snag.  I have specified on an input file the USROPN keyword, and
specified an INFSR(*PSSR) keyword also.  My *PSSR is straight forward (this
process runs at night, non-interactively):

       BegSR *PSSR;
       Dump(A);
       EndSR '*CANCL';

I am also using a variable (21 Alpha) for the input file. This file
variable will be changed several times, and the file will be closed and
re-opened each time.


It's beautiful, so far.  So the catch is that I have also started using
subprocedures, instead of subroutines.  I am attempting to resolve the
ExtFile variables, and to do the closing/opening of the files entirely in a
subprocedure.  I get two compiler errors in attempting this, as follows:


RNF5416 The subprocedure calculation specification refers to a file that has the INFSR keyword specified.

RNF7062 There is no OPEN for a file that specifies user-controlled open; the
File specification is ignored.



The first thing I ran into was that the EXTFILE variable must be declared in
the main procedure's D specs (makes sense), but I don't understand what the
above 5416 error is telling me. Can I not do an OPEN on a file within a
subprocedure? And do I need to trick the 7062 error by putting a dummy
'OPEN' op in the main procedure.


My goal is to write non-tricky, non-complex stuff where it's unnecessary.
What gives?


You can certainly use a file within a subprocedure. That includes opening and closing the file, and the reading, writing, updating, and deleting of records. But, you cannot use the file within the subprocedure if keyword INFSR is defined for the file. The reason is that you cannot invoke a subroutine if it is defined in a different procedure.


Instead, for those cases that you would handle using an INFSR, code the I/O statement in a MONITOR group, and then explicitly handle the exception in the ON-ERROR clause. Or code the (E) opcode extender and check %ERROR immediately after the I/O operation.

Cheers! Hans


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.