|
Without going through your code too much, I usually try
two things when I get unexpected results from query
especially if I'm building the QRYSLT stmt in multiple steps.
1. Change job to log CL commands so I can see exactly
what is happening including the actual QRYSLT stmt.
2. Go into debug so I can get the query engine messages.
Joe Teff
----- Original Message -----
From: <Nick_Runnalls@burmahcastrol.com>
To: <RPG400-L@midrange.com>
Sent: Wednesday, September 29, 1999 12:28 PM
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
+---
| 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 mailing list archive is Copyright 1997-2025 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.