Solved

How to use "Exception handling *PSSR"

Posted on 2004-09-16
14
5,476 Views
Last Modified: 2012-04-26
I using RPG IV, and the OS/400 is V4R3 and the RPGLE is V4R2.

I have a program which uses a logical file XOLDCD. The program encounters
the following problem. It is not able to allocate the file XOLDCD because
it is used exclusively by another process.

The error messages are:

Message Data . . . . . . . . . . . . . :
             Error message CPF4128 appeared during OPEN for file XOLDCD.

Message Identifier . . . . . . . . . . :   CPF4128
             Not able to allocate objects needed for file  in library
member

According to my knowledge, RPG IV does offers Error handling *PSSR.
However, it does not seem to work. The following are sample of statements
in my program:

HDEBUG(*YES)
F
...
FXOLDCD    IF   E           K DISK
D
...
...
D PSDS           SDS
D  Procedure        *PROC
D  Status             *STATUS
C
...
...
C     *PSSR         BEGSR
C     Status        IFGT      99
C                   .....
C                   DUMP
c                   ROLBK
C                   .....
C                   RETURN
C                   ENDIF
C                   ENDSR
...
I do not wish to allocate the file in the CL before calling this program,
because it will involve to much changes to my system. I hope someone can
advice me how it can be achieve without using a CL
0
Comment
Question by:bpteo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
14 Comments
 
LVL 27

Expert Comment

by:tliotta
ID: 12078411
bpteo:

Though you've coded a *PSSR, I don't see a INFSR(*PSSR) coded for the F-spec. I also suggest you code an INFDS for this file so the file status is available to the *PSSR.

(BTW, does this program also have a display file?)

Tom
0
 

Author Comment

by:bpteo
ID: 12081414
Hi,

Thank you for your reply. I have actually tried what you suggested. The following are the codes. But, the program still abend and went into a message wait status. And the dump show that it has not even gone beyond the first statement in the c-specs, not to mention calling the *PSSR subroutine. Any idea why the program does not seem to invoke the exception handling routine *PSSR

HDEBUG(*YES)
F
...
FXOLDCD    IF   E           K DISK    INFDS(FileSDS)  
F                                                INFSR(*PSSR)    
D PSDS           SDS
D  Procedure        *PROC
D  Status             *STATUS
D
D FileSDS         DS                    
D  FileName         *FILE              
D  FileStatus       *STATUS            
D    
C* Start of C specs                                  
C
...
...
C     *PSSR         BEGSR
C     Status        IFGT      99
C                   .....
C                   DUMP
c                   ROLBK
C                   .....
C                   RETURN
C                   ENDIF
C                   ENDSR
...
0
 
LVL 14

Accepted Solution

by:
daveslater earned 250 total points
ID: 12082599
Hi
a CPF4128 error is issued before your program has even completed in *INZSR prrocess so it will never get to the point of *PSSR.

The way I check for this error is to change the file to user open in the RPG and check for the error during the open.

dave
0
On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

 
LVL 27

Assisted Solution

by:tliotta
tliotta earned 250 total points
ID: 12087434
(D'oh!) Dave's right. If you want to move allocation testing and response into the RPG program and out of the control language, then the program must take full control.

I tend to use control language (CL) for such control functions and put business logic into business programs, so it's been far too many years since I've seen CPF4128 actually occur within RPG.

Tom
0
 
LVL 14

Expert Comment

by:daveslater
ID: 12102822
Hi again

You can not even check for this on a monmsg! Aghhhhhhhhhh

It's all about what part of the system you want to change.

The cleanest way is in the CL, so the program won't dump and you can easily send a mesasge to who ever to tell them about the problem.

Dave



0
 
LVL 27

Expert Comment

by:tliotta
ID: 12105230
Dave:

I assume you mean a MONMSG against the CALL to the RPG program fails rather than against an ALCOBJ prior to the CALL?

Tom
0
 
LVL 14

Expert Comment

by:daveslater
ID: 12105452
Hi Tom
You are indeed correct. It is a bit confusing.

dave
0
 
LVL 14

Expert Comment

by:daveslater
ID: 12250299
Hi
just a thought, if it is only the one logical file that is the problem; why not just duplicate it to a new name in the same library, the system will share the access path so they will be no system overhead. Change the one program that has an exclusive lock to use the new logical enabling all the other programs to function correctly.

Dave
0
 
LVL 27

Expert Comment

by:tliotta
ID: 12251854
Dave:

If it's a lock against the object, that should work. But if it's a lock based on the data member (i.e., the underlying physical), then I'd expect to see the same problem. No?

Seems to me that USROPN combined with explicit allocation is still the best course. Or ALCOBJ prior to CALLing the RPG. And make sure that the correct object is allocated with the appropriate lock.

Tom
0
 
LVL 14

Expert Comment

by:daveslater
ID: 12253772
Hi tom
I am unsure how the object is locked. Depending on how it is locked it could work.

Please can you tell us how the object is locked.
0
 

Expert Comment

by:madhav1980
ID: 37900764
I believe the problem is the file lock situation and handling it in RPG is easier. You can keep infsr with delay wait for certain time. and respond to the job as 'R' after some time...but this is not the right way
The other way out is you can figure out which job is locking from the sds around 90 to 118 in the ds will have the information
You can send a msg to qsysopr once the lock is released there by taking R would help.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why do some people recommend buying business VoIP from an ISP? What are the benefits to my company? What are the costs?
First of all let me say that the only language that I speak is English, but in answering questions here I often come across people whose English skills are not the best and I’d like to be able to communicate better with them, and the following descr…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question