DSPFD command throws message CPF3061

210 pts.
Tags:
AS/400
CL Program
DSPFD
I am trying to delete members from a physical file if the member size is reaced. I have written code in CL as below ->
dclf file(qtemp/ehutmp) opnid efile
create outfile by dspfd->
dspfd file(ehub) type(*mbrlist) output(*outfile) outfile(qtemp/ehutmp)
and then read file and delete old member
rcvf rcdfmt(qwhfdml) opnid(efile)
This code runs fine in my TEST machine. but throws error CPF3061 in production machine.
record format qwhfdml not found for outfile ehutmp
Please help with this. I don't know why this is happening. Any help is welcomed. Thanks in advance.
0

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.

Discuss This Question: 32  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.
  • TheRealRaven
    create outfile by dspfd->

    That seems to be not true. It's not clear from what you have shown, but it looks as if the error is thrown for the DSPFD command. The command is complaining that the EHUTMP file doesn't have the correct format.

    If EHUTMP had been created by the DSPFD command, the correct format would be created. But if the file exists when the command runs, it must first be properly created.

    We need to see more of the program in order to know why the file already exists.
    35,650 pointsBadges:
    report
  • mohit123
    The error was ->
    record format qwhfdml not found for outfile ehutmp.

    I took the following steps in CL program.

    1->  dclf file(qtemp/ehutmp) opnid efile (I used the opnid because there are two such files which member needs to be deleted.

    Create an outfile.

    2-> dspfd file(ehub) type(*mbrlist) output(*outfile) outfile(qtemp/ehutmp)

    3->read the outfile and delete old members.

    to compile the above code I ran the below  command

    dspfd file(ehub) type(*mbrlist) output(*outfile) outfile(qtemp/ehutmp).

    then source got compiled and results were expected on test machine.
    As I promoted the code to production.
    It threw error

    record format qwhfdml not found for outfile ehutmp
    on DSPFD command.

    Not sure what went wrong in production.

    I wolud like to mention there are two files in CL program for which for which same code was written.

    If parameter passed to CL pgm is e then members will be deletd from EHUB else if parameter is p then members will be deletd from EPUB file.

    let me know if any other input is required.
    210 pointsBadges:
    report
  • TheRealRaven
    Again, there isn't enough program code shown to be able to guess.
    35,650 pointsBadges:
    report
  • ToddN2000
    Check your production machine LIBL. Is this file, EHUTMP, only in QTEMP or another library? Where does that library fall in relation to QTEMP?
    133,740 pointsBadges:
    report
  • mohit123
    Thanks for the respond Todd.

    File EHUTMP is not used in any other program or library.
    It is used just as a temprory file.

    Let me explain the code ->

    we add members to ehub or ehub file depending on the &type parameter passed
    to CL program.Also we have to remove older members if member size is reached
    in PF.


    PGM(&type,&name,&text)

    DCLF (qtemp/ehubtmp) opnid efile
    DCLF (qtemp/ehuptmp) opnid pfile


    if &type = e (remove members from ehub pf)

    addpfm(&name) file(ehub)
    Monmsg (for member size reached) exec Do
    DSPFD(EHUB) type(*mbrlist) output(*outfile) outfile(qtemp/ehubtmp)
    rcvf QWHFDML opnid efile

    delete older members and add member &name.




    if &type = p (remove member from ehup pf)


    addpfm(&name) file(ehup)
    Monmsg (for member size reached) exec Do
    DSPFD(EHUP) type(*mbrlist) output(*outfile) outfile(qtemp/ehuptmp)
    rcvf QWHFDML opnid pfile

    delete older members and add member &name.

    I compiled the created the temp files by running DSPFD command mentioned in above CL program.

    It is working fine in my test machine but throwing CPF3061 on DSPFD command in CL.(record format QWHFDML not found for ehubtmp)

    we change the code in test machine and then move the changed object to production.

    no error is thrown in TEST machine but in production it does not work.

    Please advise on this.
    210 pointsBadges:
    report
  • ToddN2000
    Are you just moving the compiled object to production? Have you tried running de-bug on the object in production? When the production job halts in debug mode, look to see if the file is in the QTEMP library and what the record format name is? 

    In you program, you are declaring the file and then opening it.
    IF you are doing this from your test machine, the file will exist in your QTEMP library until you delete in or log off.

    If you try running this in production, the file does not exist yet.
    IT will not be created until you run your 
    dspfd file(ehub) type(*mbrlist) output(*outfile) outfile(qtemp/ehutmp)

    You may want to put this in another library other than QTEMP or move your declare and open AFTER your DSPFD command.
    133,740 pointsBadges:
    report
  • mohit123
    Yes we move the compile object to production and it replaces the already present object in prod.

    I have run the program in test machine when no file in qtemp exists.
    DSPFD creates the temp file in qtemp library.

    I dont understand why DSPFD is not creating the file in prod.

    I ran DSPFD only once while compiling the CL. and then on DSPFD creates outfile in qtemp itself(even when the ehutmp does not exist in qtemp lib.).
    210 pointsBadges:
    report
  • ToddN2000
    When you get the halt in production, what line of code is it referring to? If it's on the DCL statement, then that explains why the DSPFD is not running. The error prevents the command to create the file from running.
    133,740 pointsBadges:
    report
  • mohit123
    It is not on DCL.
    It is on DSPFD(record format QWHFDML not found for file EHUTMP) line.
    210 pointsBadges:
    report
  • ToddN2000
    Is it finding your input file EHUB in production? You may need to qualify the library.
    133,740 pointsBadges:
    report
  • mohit123
    the file is in a library which is always in the library list .
    program should have found the file in lib list..
    210 pointsBadges:
    report
  • CharlieBrowne

    If order for your program to compile, QTEMP/EHUTEMP has to exist on your test box. So however it was created on the test box is not the same way it is created on the production box.

    Create the file the same way on both boxes using DSPFD. now you can compile your program without having to qualify on the DCLF statement. You can just run it with *LIBL..

    62,385 pointsBadges:
    report
  • TheRealRaven
    Again, there isn't enough of the program code shown to be sure. It definitely won't work reliably according to the pseudocode that is shown.

    It's not clear at all what the ADDPFMs and MONMSGs are doing nor why DSPFD seems to be in the DO-groups of MONMSG. But that's partly because it's pseudocode rather than actual program code. We can't say why the error might be thrown against DSPFD until we see the actual program code.

    We also need to know about QTEMP/EHUBTMP and QTEMP/EHUPTMP. The error says that the files exist before DSPFD runs. So where do they come from? We need to see the actual commands that create those two files (not pseudocode).
    35,650 pointsBadges:
    report
  • mohit123
    What could be the possible reasons for cpf3061..
    210 pointsBadges:
    report
  • ToddN2000
    If this going to be a regularly scheduled job, why not put the files in a regular library instead of QTEMP? This way you can be sure the file object is always there.
    133,740 pointsBadges:
    report
  • philpl1jb
    Authority?
    54,090 pointsBadges:
    report
  • mohit123
    The user has addpfm authority which means he must have dspfd authority..??
    210 pointsBadges:
    report
  • mohit123
    What do u say Phil??
    If a user has authority to add member in a program, does it mean
     He also has authority to create outfile of same file using dspfd in same program..
    210 pointsBadges:
    report
  • philpl1jb

    You've gone to production .. all problems are authority or missing objects...

    dspfd uses some model files somewhere out in IBM land. It might have been deleted or the security on the library / file is restrictive. 

    What it can't find or doesn't have authority to is QSYS/QAFDMBRL

    That's where the system gets the format QWHFDML .

    Or not ...

    54,090 pointsBadges:
    report
  • TheRealRaven
    What could be the possible reasons for cpf3061

    The reason is given in the message: Format
    QWHFDML is not found for ehubtmp. The ADDPFM isn't affecting the problem at all.

    We can't tell you why the format isn't there until you show us the actual program code. We do know that it doesn't involve authority. It is directly from a mistake in your program.

    Showing us pseudocode or telling us an explanation of your program won't help because the program is not doing what you're telling us it does.
    35,650 pointsBadges:
    report
  • ToddN2000
    Do you have access to debug this in the production environment? This would solve everything, you could stop it and see if it does creates the file in QTEMP and then DSPFD the file and see what the actual record format name is. If you do not, ask someone who does.
    This would answer a lot of questions.
    133,740 pointsBadges:
    report
  • TheRealRaven
    From general description, it's effectively certain that the DSPFD commands are not creating the file.

    The indication of the CPF3061 is that the command found the referenced *OUTFILE already in existence and that it wasn't appropriate. I can think of various reasons why that would be true, but no useful program code means no way to tell what needs to change.
    35,650 pointsBadges:
    report
  • mohit123
    #therealraven
    I have given enough of code above.
    I am declaring two temperory files using dspfd.
    Dclf ehubtmp 
    Dclf ehuptmp

    If parameter passed is 'a' 
    Then Create outfile using dspfd which I have mentioned above
    Read outfile
    Delete members from ehub file.
    Then delete temp file.

    If parameter passed is 'b'
    Create outfile ehup using dspfd already mentioned
    Read outfile
    Delete members from ehub file.
    Delete outfile.


    I cretaed temp files(outfiles s) by running dspfd command that I am using in my cl source, for compiling the source.

    I have already told that code is not running on production.
    It is working perfectly in test machine.
    Dspfd is not throwing any error and outfile are creating at runtime with appropriate record format

    I think it is some kind of environment issue..

    Not sure what is going wrong in production..:(
    210 pointsBadges:
    report
  • TheRealRaven
    Then Create outfile using dspfd which I have mentioned above...

    Except that is not true. The error message tells us it's not true. If it created the file, it would not suddenly decide that it created it with an incorrect format.

    Therefore, something else is wrong before DSPFD runs. Since you won't show the code, we can't help. Nor can any other source help as long as the program code isn't available.
    35,650 pointsBadges:
    report
  • mohit123
    The program is called in batch mode.
    And I don't know what previous programs do before calling my cl.
    So the possibility is that one of the previous program which is calling my cl is creating the same outfile with different format.

    So when I do dspfd it is not finding the correct record format.
    210 pointsBadges:
    report
  • ToddN2000
    if you have a production sign-on try entering this at a command line. in not then get somebody that does to verify your commands work in production.

    dspfd file(ehub) type(*mbrlist) output(*outfile) outfile(qtemp/ehutmp)

    then do a DSPFD and 

    1. see if it is there
    2 what is the name of the record format?

    Report back with findings.

    Other than that, without access to your system to test your code , we cannot proceed further as the code and errors do not make any logical sense to this point.
    133,740 pointsBadges:
    report
  • mohit123
    Thanks Todd for sticking with the issue.

    I will inform you when I found how it works in production.

    210 pointsBadges:
    report
  • TheRealRaven
    Unfortunately, it might not matter if it's found or not found. If it's found, then it's evidence that the command isn't creating it when it runs. If it's not found, well, it doesn't tell us anything.

    Be sure to qualify to QTEMP when searching.
    35,650 pointsBadges:
    report
  • TheRealRaven
    So the possibility is that one of the previous program which is calling my cl is creating the same outfile with different format.

    That's a possibility that would have been clear if the actual program had been shown in the original question. If it's what's happening, the program that creates the file should delete it when it's finished with the file.

    And if it doesn't delete the file, it might not be safe to delete it at the start of your program. The file might be expected to be used elsewhere and deleting it might cause bigger problems for the job.
    35,650 pointsBadges:
    report
  • mohit123
    Now I am thinking to change the code and using rtvmbrd command to process the pf and delete members which are older than a date.

    Rtvmbrd will read the members in pf sequentilaay and will perform the desired action.
    210 pointsBadges:
    report
  • ToddN2000
    That may be the case. If the file is created in QTEMP it stays until deleted. If you did a DSPFD with *MBRLIST it will have a different RCDFMT than sya *ACCPTH or *ATR. This may explain why that format is not found.
    133,740 pointsBadges:
    report
  • TheRealRaven
    Technically, I'd use the List Database File Members (QUSLMBR) API if there were enough members to be a concern to begin with. Second to that, I'd use the RTVMBRD command. I'd only use DSPFD to an *OUTFILE if I actually needed a database file to manipulate for some reason or perhaps for reporting.

    I'd say switching to RTVMBRD is a good choice. But the experience with DSPFD *OUTFILEs and CL file processing is good regardless.
    35,650 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.

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

Following

Share this item with your network: