× 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.


  • Subject: RE:Trapping a level check in RPG
  • From: Buck Calabro <mcalabro@xxxxxxxxxxxx>
  • Date: Wed, 4 Mar 1998 17:25:14 -0500

>How do i trap level check errors in RPG program. To my knowledge we
>can't do this using *PSSR, are there any other possibilities?.  Any help
>would be appreciated.

The mechanism at work here is the default error handler.
RPG sets the default error handler from the time the program starts
to run, and the time initialisation is complete.  At that time, if you
have a *PSSR defined, this becomes your error handler.

The problem is that if you let RPG open a file, this occurs before
initialisation is complete, so the default handler deals with it.

The way I've dealt with this is to declare your file as User Controlled
open/close.  During your "setup" code (*INZSR or equivalent) perform
an OPEN opcode.  Put an indicator in the LO columns (56-57).  If you
get an error, this indicator will be turned on.  You can check the Program
Status data structure to retrieve the actual message returned by the
operating system.  I'm sure there's a better way with RPG IV, but
here's code snippets from RPG III:

FPGMIND  IF  E           K        DISK                           UC 
F                                              KINFSR *PSSR         

I           SDS                                      
I                                       91 170 PSDSMG
I                                      244 253 TMNAME

C                     OPEN PGMIND                 20          
C*                                                            
C*   If an error occurs, display the message from CPF and let 
C* the user decide what to do. 
C*                                                            
C   20                DO                                      
C                     SETON                     44            
C                     MOVELPSDSMG    MESSAG                   
C                     GOTO TAG000                             
C                     END                                     

hth
Buck Calabro
Commsoft

+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.