Error CPF4208 in OVRPRTF

2375 pts.
Tags:
AS/400
OVRPRTF
Hi! Im getting this error message while doing OVRPRTF. SAMLETT is a RPG program. SAMLEV is printer file. Message . . . . :   Error message CPF4208 appeared during OPEN (C G D F). Cause . . . . . :   RPG procedure SAMLETT in program L1ASRCT/SAMLETT received the message CPF4208 at statement 5 while performing an explicit OPEN operation on file SAMLEV. The actual file is SAMLEV. Recovery  . . . :   Check the job log for a complete description of message CPF4208, and contact the person responsible for program maintenance. Possible choices for replying to message . . . . . . . . . . . . . . . : D -- Obtain RPG formatted dump. S -- Obtain system dump. G -- Continue processing at label *GETIN. C -- Cancel. F -- Obtain full formatted dump. Surey.

Answer Wiki

Thanks. We'll let you know when a new response is added.

I agree with Wood. 

With the quotes, &TARGET is a constant instead of a variable.
Good catch Wood

Discuss This Question: 14  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
  • CharlieBrowne

    First check the JOBLOG for more detailed information about the error.

    You description has OVRPRTF. Please should us your OVRPRTF statement and let us know if it is being done at the same level as the call to your program. (It could be an activation group issue.

    41,370 pointsBadges:
    report
  • Splat
    Per the message text, your file wasn't opened.  Is your printer file defined with the USROPN keyword?
    6,815 pointsBadges:
    report
  • Sureyz
    Here is my OVRPRTF File :


    OVRPRTF  FILE(&PRTF)  DEVTYPE(*AFPDS)  TOSTMF('&TARGET')  WSCST(*PDF)  OVRSCOPE(*JOB)

    CALL  PGM(*LIBL/&PROGRAM)

    DLTOVR  FILE(&PRTF)  LVL(*JOB)

    CLOF  OPNID(&PRTF)


    Values &PRTF, & PROGRAM, and & TARGET are being passed from another RPGLE program.


    Surey.




    2,375 pointsBadges:
    report
  • Sureyz
    Hi Splat !

    The printer file id defined with USROPN and the program like.

    OPEN  &PRTF
    Eval  A = A+B
    Movel  'NAME'   Field1
    Write RCD001
    Write BOX001
    Close &PRTF


     
    2,375 pointsBadges:
    report
  • philpl1jb
    What does your f-spec look like for &PRTF???
    49,550 pointsBadges:
    report
  • WoodEngineer
    I think your do not need quotes around &TARGET.
    6,305 pointsBadges:
    report
  • Splat
    If it weren't for the code snippet posted I'd suspect the RPGLE program is attempting to open the print file a second time.

    Is there a program dump available?  That would help pinpoint the line of code causing the problem.

    BTW, are you opening the print file in the CL program?  If not, and as you seem to be closing the print file in the RPGLE, the CLOF OPNID(&PRTF) is superfluous.
    6,815 pointsBadges:
    report
  • philpl1jb
    I think Woody is on to something ..
    49,550 pointsBadges:
    report
  • Sureyz
    This is my CL

    PGM        PARM(&PROGRM &PRTFIL &FOLDER)
    DCL        VAR(&PROGRM) TYPE(*CHAR) LEN(15)
    DCL        VAR(&PRTFIL) TYPE(*CHAR) LEN(15)
    DCL        VAR(&FOLDER) TYPE(*CHAR) LEN(30)

    OVRPRTF    FILE(&PRTFIL) DEVTYPE(*AFPDS) +
                 TOSTMF(&FOLDER) WSCST(*PDF) +
                 OVRSCOPE(*JOB)              
    CALL       PGM(*LIBL/&PROGRM)    
    DLTOVR     FILE(&PRTFIL) LVL(*JOB)
    CLOF       OPNID(&PRTFIL)        
    ENDPGM                           

    I tried without the quotes but still the same error.
    and this is the file declaration in RPGLE.

    SAMLEV    O    E             PRINTER USROPN

    OPEN SAMLEV
    --assignes
    WRITE RCD001
    WRITE BOX001
    CLOSE SAMLEV

    The error is when it reaches the CLOF in CL pgm. As

    Message . . . . :   No file open with identifier SAMLEV.                      
    Recovery  . . . :   Change the name in the OPNID parameter value on the Close 
      File (CLOF) command to the name of the file that is currently in use.  Then 
      try the request again.                                                      

    I can guess the error is indicating that the file is not opened in the CL pgm but its is closed.



    Can you please suggest ?

    Surey.


    2,375 pointsBadges:
    report
  • Splat
    The file is never opened in the CL; it's opened & closed in the RPG. 
    6,815 pointsBadges:
    report
  • Splat
    Sorry, hit Enter before I intended to.

    Unless you have a particular reason for closing the file in the CL, remove the CLOF command.
    6,815 pointsBadges:
    report
  • WoodEngineer
    CLOF is for database files, not print files.  Just delete the CLOF line in your program.
    6,305 pointsBadges:
    report
  • Sureyz
    Yes.. that was the problem in the program.

    Thanks all.
    2,375 pointsBadges:
    report
  • andonim
    You have to erase the disc before the document: RMVLNK OBJLNK (&FOLDER)
    10 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