Solved

How to use "Exception handling *PSSR"

Posted on 2004-09-16
14
5,244 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
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
 
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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Find out what Office 365 Transport Rules are, how they work and their limitations managing Office 365 signatures.
A Short Story about the Best File Recovery Software – Acronis True Image 2017
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

707 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now