Solved

How to use "Exception handling *PSSR"

Posted on 2004-09-16
14
5,287 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
There are many Password Managers (PM) out there to choose from. PM's can help with your password habits and routines, but they should not be a crutch you rely on too heavily. I also have an article for company/enterprise PM's.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
I designed this idea while studying technology in the classroom.  This is a semester long project.  Students are asked to take photographs on a specific topic which they find meaningful, it can be a place or situation such as travel or homelessness.…

919 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

16 Experts available now in Live!

Get 1:1 Help Now