CPF4326

1420 pts.
Tags:
AS/400
CLP
RPGLE
Hi all, I am reading data from a file PF1 using LF1 sequentially, and writing to other file PF2 using using LF2 using RPG Program R1. When I run it using CALL R1, it's working absolutely fine. But when use SBMJOB to submit it as batch job, it is going to MSGW. the error is: " CPF4326 occurred for the file LF2 while trying to Open ( C D S F) ". Even I changed the commitment control using STRCMTCTL *CHG, still same error. Again I tried with a CL program C1, which have a call statement CALL R1, and this time i submitted CL program C1. Still I'm getting the same error. Please suggest me fix this error.

Software/Hardware used:
AS400, RPG 400,CLP/CLLE.

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question: 23  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • philpl1jb

    1.  is source type RPG , RPGLE, sqlrpg

    2.  do you want to use commitment control?

    3.  the sbmjob is calling the RPG program

    4.  "changed the commitment control using STRCMTCTL *CHG"  where/how did you change it?

    5.  is there an F-spec for this file in the RPG .. please show it.

     

    49,435 pointsBadges:
    report
  • TomLiotta

    Phil's asked the basic questions.

    Most likely, file PF2 is not journaled. Start journaling PF2, and the problem should go away. Alternatively, don't run R1 under commitment control.

    What did the CPF4326 message say? When you tried to apply the suggested recoveries from the CPF4326 message, what happened? What does R1 do to affect commitment control? How was it compiled?  Is R1 OPM or ILE? Is it a SQL RPG program? If it is, what was the COMMIT() parameter value at compile-time?

    Calling R1 in an interactive job would allow it to run within a commitment definition that was active at the time it was called. But calling R1 via SBMJOB would mean that R1 would have to create the commitment definition.

    Even i changed the commitment control using STRCMTCTL *CHG, still same error.

    The problem is probably showing up because the program is already running under *CHG. If you run STRCMTCTL *CHG, you are only setting the attribute to a value that is already causing the problem.

    How did you run STRCMTCTL? Was it only in your interactive job?

    Again i tried with a CL program C1, which have a call statement CALL R1, and this time i submitted CL program C1.

    That wouldn't have any effect at all on the problem unless C1 changed the commitment definition.

    Tom

    125,585 pointsBadges:
    report
  • Sai4AS400
    Hi,
    PF2 is already journaled, My R1 is a RPGLE Program, it is not a SQL RPG Program.My code is like this..

    FL1 IF K DISK /*L1 IS LOGICAL FILE ON PF1*/
    FL2 UF A K DISK COMMIT /*L2 IS LOGICAL FILE ON PF2*/
    Error: CPF4326 occured for the file L1 while open.
    1,420 pointsBadges:
    report
  • Sai4AS400
    My Code :

    FL1       IF        K    DISK               /*L1 IS LOGICAL FILE ON PF1*/
    FL2      UF   A    K    DISK    COMMIT  /*L2 IS LOGICAL FILE ON PF2*/

    Error: CPF4326 occured for the file L1 while open.
    1,420 pointsBadges:
    report
  • Sai4AS400
    Hi philp,
    i did used STRCMTCTL *CHG in the command prompt just before submitting the Job..Please tell me how should i proceed in this case?..Thanks.
    1,420 pointsBadges:
    report
  • philpl1jb

    When you submit a job, it's an independent job .. it doesn't inherit the conditions of the submitter.

     

    Typically we would have a cl which

    1.  Issues the STRCMTCTL  (at Job level or call level)

    2. Calls the RPG program

    3. Issues the ENDCMTCTL (at the same level)

     

    49,435 pointsBadges:
    report
  • TomLiotta

    Error: CPF4326 occured for the file L1 while open.

    Make certain that the message is against L1. If the error was thrown against L1, it doesn't make much sense because L1 is just an 'I'nput file. The most reasonable possibility seems to be that you have uncommitted changes to PF1 that are still pending when you call R1. R1 could not know what records are valid until the changes are committed.

    If that's the case, then commit those changes before trying to run SBMJOB for CALL R1. Run WRKCMTDFN to see what commitment definitions are related to PF1, and ensure that they are committed before SBMJOB.

    Or don't submit R1; run it in the interactive job. But there shouldn't be uncommitted changes before R1 runs.

    Tom

    125,585 pointsBadges:
    report
  • Sai4AS400
    Hi Tom & Phil, 

    Please answer me that error is for L2 not for L1, since L1 is already commited. Thanks!
    1,420 pointsBadges:
    report
  • TomLiotta

    i did used STRCMTCTL *CHG in the command prompt just before submitting

    That possibly makes the problem worse. You can't run STRCMTCTL in one job and expect to have an effect in a different job. It's not going to help the submitted job, and it might interfere depending on what is happening in the interactive job.

    ...that error is for L2 not for L1...

    We need to know which file has the problem. If we're going to help, show us the CPF4326 error message. We have to have good info to work from.

    Tom

    125,585 pointsBadges:
    report
  • Sai4AS400
    Hi Tom, the error is for the file L2, through  which we are writing data to File PF2. The error message is : CPF4326 occured for the file L2 while trying to
    Open ( C D S F). 
    1,420 pointsBadges:
    report
  • Sai4AS400
    One more thing is... Do i need to set commit control for the object L2 in top most library of *LIBL ? isn't it fine if i set commit control for any of the 
    object L2 in *LIBL?..please clarify.
    1,420 pointsBadges:
    report
  • philpl1jb

    FL1 IF K DISK /*L1 IS LOGICAL FILE ON PF1*/
    FL2 UF A K DISK COMMIT

    1.  Only files that are opened for update or add need commit

    2.  Your file FL2 is to be opened for commit .. that leads to PF2 which should/is journalled.  So your F spec has the correct COMMIT on FL2.

    3.  You should be submitting a CL as I described which starts commitment control and then calls the rpg program. and at it's end issues an ENDCMT

    4.  Your RPG program should have a commit or rollback to commit the change(s).

    49,435 pointsBadges:
    report
  • philpl1jb
    Do i need to set commit control for the object L2 in top most library of *LIBL ? isn’t it fine if i set commit control for any of the 
    object L2 in *LIBL?..please clarify.
     
    I don't understand your question. 
    You're RPG program will attempt to open the first file named L2 that it finds in the jobs library list.  If the STRCMTCTL has been issued in the job and the logical L2 points at a physical that is journalled, it will work.  It doesn't need to be in the first library in the library list.
    49,435 pointsBadges:
    report
  • philpl1jb

    But before you continue

    1.  End any jobs you have running

    2.  End all of your interactive sessions.

    This will rollback any pending changes you've made in PF2 and any commitment control that you've started.

     

    49,435 pointsBadges:
    report
  • TomLiotta

    The error message is : CPF4326 occured for the file L2 while trying to...

    That is not the error message. That is the RNQ1216 inquiry message. And it doesn't look like it's even the actual RNQ1216 message text. It looks like you are trying to type what the message says. You need to copy/paste the real text.

    The error message is CPF4326.

    However, the important part is what file the message references; and it seems to be L2 (if the message text is provided to us correctly). If the F-specs you showed us are correct, it makes sense that L2 is causing an error.

    You need to run STRCMTCTL in the submitted job before R1 opens L2. That can be done by creating a CL wrapper for R1 or by changing L2 to be USROPN and calling one of the command execution APIs. Alternatively, remove the COMMIT keyword from the F-spec.

    Tom

    125,585 pointsBadges:
    report
  • Sai4AS400
    Do i need to use OVRDBF on the file PF2 in CL in this case ? else can i directly use STRCMTCTL LCKVELEL(*CHG)  OPNSCOPE(*JOB)                        
          CALL   PGM(R1)                                                                                      
          COMMIT                                                                                                      ENDCMTCTL.     

    1,420 pointsBadges:
    report
  • philpl1jb

    There are purposes for the OVRDBF on the file PF2 .. including to identify a different file but if you don't need some feature of OVRDBF then you don't need the command.

     

    The cl only requires these three commands ..

    STRCMTCTL LCKVELEL(*CHG)  OPNSCOPE(*JOB)            

     CALL  PGMR1)                                                                                      

     ENDCMTCTL.     
     
    The COMMIT would typically be included in the RPG program .. to commit each unit of work when it's complete or to commit all work at the end of the program.  Rollback can also be included in the RPG at points were the decision has been made to rollback a unit of works changes.
    49,435 pointsBadges:
    report
  • Sai4AS400
    Is there any way to get the data into the Output file even though there is CPF4326 is existing on the Output file PF2? i.e is there any Reply by using/issueing which we can neglect this error and proceed, so that we can get data into the output file PF2....
    1,420 pointsBadges:
    report
  • philpl1jb

    Surely we've answered this.

    FL2      UF   A    K    DISK    COMMIT  /*L2 IS LOGICAL FILE ON PF2*/

    Take the COMMIT off this line and you will not get the error.

    Submit the CL to start commitment control and call the RPG program and you will not get the error.

    If your intent is to run commitment control then you should not run if you are getting this error.

    49,435 pointsBadges:
    report
  • philpl1jb

    If your intent is to run commitment control then you should not continue if you get this error.

    49,435 pointsBadges:
    report
  • philpl1jb

    Pleasse show us the error text that you are currently receiving with CPF4326.

     

    49,435 pointsBadges:
    report
  • TomLiotta

    Is there any way to get the data into the Output file even though there is CPF4326 is existing on the Output file PF2?

    Yes. Run a different program that doesn't require commitment control.

    However, if you don't care about commitment control, just do as Phil suggested. Remove COMMIT from the F-spec and recompile the program. Don't put a requirement into program code if it's not needed.

    But note that the COMMIT keyword has an optional parameter. You can change the program to set the commitment control requirement on or off if needed.

    Tom

    125,585 pointsBadges:
    report
  • Sai4AS400
    Thanks for your info and help..
    1,420 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following