CLP Programming

380 pts.
Tags:
CL programming
CLP
PGM DCLF FILE(AMITLIB/STUDPF) LOOP: RCVF RCDFMT(STUDRRC) MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(END)) SNDUSRMSG MSG(&NAME) OPNQRYF FILE((AMITLIB/STUDPF)) QRYSLT(*ALL) GOTO CMDLBL(LOOP) END: ENDPGM it displays only the first data in the file. how to display all the records present in the file?
ASKED: March 18, 2013  9:47 AM

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: 15  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
  • TomLiotta
    Get rid of the OPNQRYF. I have no interest in testing how it interferes with the RCVF, but trying to open a query file against the same file you have already opened and read a record from seems like a very bad idea. There is no point in doing it. -- Tom
    125,585 pointsBadges:
    report
  • TomLiotta
    And running OPNQRYF for every record in a loop is a bad idea all by itself.
    125,585 pointsBadges:
    report
  • jainamit
    Thnx Tom :)
    380 pointsBadges:
    report
  • jainamit
    Now what if i want to display some specific record from the file.
    380 pointsBadges:
    report
  • TomLiotta
    Then display just the record that you want. Why is that a problem for you? -- Tom
    125,585 pointsBadges:
    report
  • jainamit
    The problem is that i'm not able to do it..i tried overriding the file and then use openqry. But it is not giving the desired output
    380 pointsBadges:
    report
  • jainamit
    this is what i tried  
    380 pointsBadges:
    report
  • jainamit
    OVRDBF     FILE(STUDPF) TOFILE(AMITLIB/STUDPF) +                     MBR(*FIRST) SHARE(*YES)                    OPNQRYF    FILE((AMITLIB/STUDPF)) QRYSLT('''id *ge "'' +             *cat &var *cat''"''')                     
    380 pointsBadges:
    report
  • TomLiotta
    Now, if your RCVF loop comes after the OPNQRYF, what do you get? It's possible to do it by using RCVF after OPNQRYF. But usually a CL program would simply use RCVF in a loop without OPNQRYF. You'd just have an IF command inside the loop to test for the record you want to display. -- Tom
    125,585 pointsBadges:
    report
  • jainamit
    what is wrong in this code..??
    380 pointsBadges:
    report
  • jainamit
    PGM DCLF FILE(AMITLIB/STUDPF) DCL VAR(&VAR1) TYPE(*DEC) LEN(6) VALUE(672419) LOOP: RCVF RCDFMT(STUDRRC) MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(END)) SNDUSRMSG MSG(&NAME) OVRDBF FILE(STUDPF) TOFILE(AMITLIB/STUDPF) + MBR(*FIRST) SHARE(*YES) OPNQRYF FILE((STUDPF)) QRYSLT('(ID *GT "672419")') + KEYFLD(*FILE) CPYFRMQRYF FROMOPNID(STUDPF) TOFILE(AMITLIB/STUDPF1) + MBROPT(*ADD) FMTOPT(*NOCHK) GOTO CMDLBL(LOOP) DLTOVR FILE(STUDPF) CLOF OPNID(MYFILE) END: ENDPGM
    380 pointsBadges:
    report
  • jainamit
    it throws CPF4174 received by OVRRIDE2 at 209  error.  
    380 pointsBadges:
    report
  • philpl1jb
    Typically the OpnQryF is used to control downsteam programs. Trying to affect a program that has an file already open ?? doesn't seem possible. As far as your code goes .. if it were to work, you must dlt the override and close the file every loop.      I'm a little off today on the """" quotes in the query select.
    48,575 pointsBadges:
    report
  • TomLiotta
    it throws CPF4174 received by OVRRIDE2 at 209  error.   Of course it does. That's what should happen for that program. You try to apply an override after you already opened the file.   Previous comments have said that you should not have OPNQRYF after you already ran RCVF. The same is true for OVRDBF. When RCVF runs, it causes the file to be opened automatically. Because the file is already open, it is too late to run OVRDBF.   There are other errors. For example, the DLTOVR immediately follows GOTO, and it doesn't have a label. There is no way it can ever run.   Don't do OVRDBF or OPNQRYF after RCVF for the same file.   Tom
    125,585 pointsBadges:
    report
  • jainamit
    ok.. thanks a lot Tom
    380 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