Solved

How to use "Exception handling *PSSR"

Posted on 2004-09-16
14
5,419 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
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.

 
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: 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

Suggested Solutions

Title # Comments Views Activity
Change a nightly backup CL program 5 241
IBM DB2 Query Manager and SQL Development Kit for i not available 7 326
adodb sql multi tables 1 1,301
IBM Lotus Notes Rules not working 5 357
Invest in your employees with these five simple steps to improve employee engagement and retention.
Unified and professional email signatures help maintain a consistent company brand image to the outside world. This article shows how to create an email signature in Exchange Server 2010 using a transport rule and how to overcome native limitations …
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

752 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