Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to use "Exception handling *PSSR"

Posted on 2004-09-16
14
Medium Priority
?
5,581 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
11 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 1000 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
NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

 
LVL 27

Assisted Solution

by:tliotta
tliotta earned 1000 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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Did you know there are services out there that can turn an Instagram feed into an RSS feed? I found some interesting exclusive Instagram content which I wanted to follow without signing up for yet another social media account. RSS to the rescue!
Transferring FSMO roles is done when an admin wants to split roles between certain Domain Controllers or the Domain Controller holding the Roles has been forcefully demoted using dcpromo / forceremoval
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Screencast - Getting to Know the Pipeline

877 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