IBM i Global

IBM i 

A space for professionals working with IBM’s integrated OS for Power systems to exchange ideas, ask questions, and share expertise on topics like RPG and COBOL development, application modernization, open source integration, system administration, and business continuity.


#Power


#IBMi
 View Only
  • 1.  Cannot trap error CPF4128 in RPG with *PSSR and PSDS defined

    Posted Mon May 22, 2023 09:08 AM

    Hello

    I have an RPG program that has *PSSR on every file declared in F-spec.
    And have defined both *PSSR subroutine & have Program Status DS defined. 
    Yet the program control will NOT got into *PSSR when CPF4128 error occurs & the RPG Halts with this error.

    CPF4128 is Not able to allocate objects needed for a file.

    Will you please tell me what I am missing ?

    Thank you



    ------------------------------
    Mohan Eashver
    ------------------------------


  • 2.  RE: Cannot trap error CPF4128 in RPG with *PSSR and PSDS defined

    Posted Tue May 23, 2023 06:55 AM

    Is the file defined with USROPN? If not, the file is opened during the *INIT phase of the RPG cycle, and the INFSR is not active yet.

    See this page in the ILE RPG Reference: https://www.ibm.com/docs/en/i/7.5?topic=exceptionerrors-file-exceptionerror-subroutine-infsr

    It says "If a file exception/error occurs during the start or end of a program, control passes to the RPG IV default error handler, and not to the user-written file exception/error or subroutine (INFSR)."



    ------------------------------
    Barbara Morris
    ------------------------------



  • 3.  RE: Cannot trap error CPF4128 in RPG with *PSSR and PSDS defined

    Posted Tue May 23, 2023 09:09 AM

    Thank you Barbara.



    ------------------------------
    Mohan Eashver
    ------------------------------



  • 4.  RE: Cannot trap error CPF4128 in RPG with *PSSR and PSDS defined

    Posted Tue May 23, 2023 06:58 AM

    By the way, there is a forum specifically for RPG: https://www.ibm.com/support/pages/node/1106229#forum



    ------------------------------
    Barbara Morris
    ------------------------------



  • 5.  RE: Cannot trap error CPF4128 in RPG with *PSSR and PSDS defined
    Best Answer

    Posted Tue May 23, 2023 08:12 AM

    I like Barbara's answer but here's some more.  If you do use USROPN you can trap the error also with ON-ERROR.  Your exception routines could even include IBM i Services to tell them who has the file locked, and if you're really confident of this user, blow the job away.
    How to list locks:
    QSYS2.OBJECT_LOCK_INFO
    QSYS2.RECORD_LOCK_INFO
    How to see your joblog:
    QSYS2.JOBLOG_INFO()
    Info on these (like release and ptf support required) are available at:
    https://www.ibm.com/support/pages/node/1119123



    ------------------------------
    Robert Berendt IBMChampion
    ------------------------------



  • 6.  RE: Cannot trap error CPF4128 in RPG with *PSSR and PSDS defined

    Posted Tue May 23, 2023 09:10 AM

    Thank you Rob.



    ------------------------------
    Mohan Eashver
    ------------------------------



  • 7.  RE: Cannot trap error CPF4128 in RPG with *PSSR and PSDS defined

    Posted Tue May 23, 2023 02:08 PM

    Hi Mohan, I take it this is an issue when the file is opened. Are you doing a user controlled open?



    ------------------------------
    Dave Garvey
    ------------------------------