× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: RE: OPNQRYF does not seem to be working
  • From: Chris Bipes <ChrisB@xxxxxxxxxxxxxxx>
  • Date: Wed, 29 Sep 1999 12:12:26 -0700

Once you cpyfrmqryf are at the end of file and once you reach end of file,
you cannot re-position the cursor.  Why do you need the cpyfrmqryf?  It is
best not to use this.  If the RPG does not update and you need the cpy for
down stream processing, run the RPG first.  The cpyfrmqryf will reposition
and copy correctly after the RPG ends and closes the file.  To run the RPG
after the CPYFRMQRYF the cl must close the file, but then you lost the
opnqryf results.  A catch 22.  If your RPG is not updating you can also
close the qryf, override to the qtemp file and run your RPG.  No share is
involved and you can get rid of that.  Now for the killer,  When you need a
copy of the file and need to update the file,  have the RPG output the
original record to the qtemp file as you process but before you update any
fields.  This output replaces the cpyfrmqryf and increases performance.  You
must first create the qtemp file though.  CRTDUPOBJ with DATA(*NO) works
great, once you have the library name.  Use RTVOBJD *libl/objname *file
rtnlib(&lib) to get your library's name.  I wish that IBM would change the
EOF indicator and allow you to reposition the file cursor after the
cpyfrmqryf.  Though the above suggestion does out perform processing the
opnqryf twice.

Christopher K. Bipes    mailto:ChrisB@Cross-Check.com
Sr. Programmer/Analyst  mailto:Chris_Bipes@Yahoo.com
CrossCheck, Inc.        http://www.cross-check.com
6119 State Farm Drive   Phone: 707 586-0551 x 1102
Rohnert Park CA  94928  Fax: 707 586-1884

*Note to Recruiters
I nor anyone that I know of is interested in any new and/or exciting
positions. Please do not contact me.


-----Original Message-----
From: Nick_Runnalls@burmahcastrol.com
[mailto:Nick_Runnalls@burmahcastrol.com]
Sent: Wednesday, September 29, 1999 10:28 AM
To: RPG400-L@midrange.com
Subject: OPNQRYF does not seem to be working




I have the following CL Program



             PGM        PARM(&CUST &MAST &LANG)

             DCL        VAR(&CUST) TYPE(*DEC) LEN(8 0)
             DCL        VAR(&MAST) TYPE(*DEC) LEN(8 0)
             DCL        VAR(&CUSTA) TYPE(*CHAR) LEN(8)
             DCL        VAR(&LANG) TYPE(*CHAR) LEN(3)
             DCL        VAR(&QRYSEL) TYPE(*CHAR) LEN(128)
             DCL        VAR(&ZERO) TYPE(*DEC) LEN(8 0) VALUE(0)

/*------------------------------------------------------------------*/
/*     Generic message monitor                                      */
/*------------------------------------------------------------------*/
             MONMSG     MSGID(CPF0000 RPG0000 MCH0000)

             CHGVAR     VAR(&CUSTA) VALUE(&CUST)

             CHGVAR     VAR(%SST(&QRYSEL 1 10)) VALUE('CPMAST *EQ')

             CHGVAR     VAR(%SST(&QRYSEL 12 8)) VALUE(&MAST)

             IF         COND(&CUST *NE &ZERO) THEN(DO)
             CHGVAR     VAR(&QRYSEL) VALUE(&QRYSEL *CAT 'CPCLOC *EQ +
                          ' *CAT &CUSTA)
             ENDDO

             OVRDBF      LABCMPL1 SHARE(*YES)

             OPNQRYF    FILE((LABCMPL1)) OPTION(*INP) +
                          QRYSLT(&QRYSEL) KEYFLD(*FILE)
/*           CPYFRMQRYF FROMOPNID(LABCMPL1) TOFILE(QTEMP/LABCMP) +
                          CRTFILE(*YES)  */

             CHGVAR     VAR(%SST(&QRYSEL 1 10)) VALUE('SAMAST *EQ')
             CHGVAR     VAR(%SST(&QRYSEL 12 8)) VALUE(&MAST)


             IF         COND(&CUST *NE &ZERO) THEN(DO)
             CHGVAR     VAR(&QRYSEL) VALUE(&QRYSEL *CAT ' SACUST *EQ +

                          ' *CAT &CUSTA)
             ENDDO


             OVRDBF      LABMASL6 SHARE(*YES)
             OPNQRYF    FILE((LABMASL6)) OPTION(*INP) +
                          QRYSLT(&QRYSEL) KEYFLD((SAMAST) (SAUNIT) +
                          (SACOMT) (SALOCN) (SASAMP *DESCEND)) +
                          UNIQUEKEY(4)
/*           CPYFRMQRYF FROMOPNID(LABMASL6) TOFILE(QTEMP/LABMAS) +
                          CRTFILE(*YES) */

/*------------------------------------------------------------------*/
/*    Call Print                                                    */
/*------------------------------------------------------------------*/

             CALL       PGM(LBK0UPR) PARM(&CUST &MAST &LANG)


             DLTOVR     FILE(*ALL)

            CLOF       OPNID(LABCMPL1)
            CLOF       OPNID(LABMASL6)

            ENDPGM


It is selecting no records in the RPG IV program (LBK0UPR).

If the commented out CPYFRMQRYF statements are run the data is selected
correctly in those files. Ihave tried using POSDBF

It does not help.



I have been through the archives and others are hinting at these problems.
The access paths were already shared open and i have tried removing the
OVRDBF  commands none of it seems to make a diffrence. Am I going Mad. I
have used OPNQRYF much in the past, but with RPG III or 400 whatever



Anyone solved this


+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator:
david@midrange.com
+---
+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.