Unconfigured Ad Widget

Collapse

Announcement

Collapse
No announcement yet.

OPNQRYF works, but RPG pgm finds no records

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • OPNQRYF works, but RPG pgm finds no records

    That since the access path of the OPNQRY FILE is being shared, the CPYFRMQRYF commnad isreading it to end of file, and that is where the RPG program starts. Is there a need to perform the CPYFRMQRYF? Could the RPG program be modified to read that file instead? You can verify this by simply commenting out the CPYFRMQRYF and see if the RPG program gets data this time. Then figure out how to redesign the app. Good luck!

  • #2
    OPNQRYF works, but RPG pgm finds no records

    You are right. I commented out my debugging tool and it works fine! Thanks

    Comment


    • #3
      OPNQRYF works, but RPG pgm finds no records

      Comment


      • #4
        OPNQRYF works, but RPG pgm finds no records

        You can still read the file in RPG program after the CPYFRMQRYF file. You just have to reposition the file pointer to start by using POSDBF POSITION(*START). Call the program after this and close the OPNQRYF and delete overrides.

        Comment


        • #5
          OPNQRYF works, but RPG pgm finds no records

          I use the following to create a view over my file to be read by the program: OVRDBF FILE(TRPHIST) SHARE(*YES) /* */ OPNQRYF FILE((TRPHIST)) FORMAT(*FILE) + QRYSLT(&QRYSLT) KEYFLD((&KEY1) (&KEY2) + (&KEY3) (&KEY4)) CPYFRMQRYF FROMOPNID(TRPHIST) TOFILE(DACLIB/QRYOUTP) + MBROPT(*REPLACE) CRTFILE(*NO) CALL PGM(TRRTRPRT) PARM(&TRTYP) The program (TRRTRPRT) reads TRPHIST... and ends immediately with %Eof condition. This WORKED at first, but then didn't after I started messing with the Key fields... but the copied query file looks fine! Any ideas?

          Comment


          • #6
            OPNQRYF works, but RPG pgm finds no records

            Hello You can use a share on the OPNQRYF instead of the CPYFRMQRYF. See the code in exemple. Regards
            Code

            Comment

            Working...
            X