|
Bob: As others have mentioned, building the string in a variable and then using that variable in OPNQRYF can be a huge help. It allows you to view the content of the variable in debug separate from running the OPNQRYF command. But there are other bits to consider as possible matters of style. First, enter all of your CL in lower-case except for constants that _need_ to be upper-case. Then, when making changes, replicate the statement and change the new copy. You can then prompt the new, changed copy to see the result. This will automatically upper-case everything _except_ such items as quoted constants. That means that you can get a neat visual indication of whether or not elements such as *CAT and *EQ have been improperly (or properly) enclosed in quotes since what's inside quotes won't be upper-cased. Once you have the changed statement the way you want it, make the visually verified changes to the original statement and delete the temporary new statement. Your changed statement should be all lower-case again _except_ for the bits that _require_ upper-case. It can make for much slower statement entry, but it really helps maintain statement integrity. Tom Liotta midrange-l-request@xxxxxxxxxxxx wrote:
4. Re: PROBLEM WITH OPNQRYF (Bob O.) I I added the quotes like you said. When I run the program I am still getting the CPF9899 error message saying that I'm missing an operand. I can't see where I'm missing anything. PGM QSYS/DCL VAR(&DIV) TYPE(*CHAR) LEN(1) QSYS/DCL VAR(&BOOK) TYPE(*CHAR) LEN(6) /* */ QSYS/CALL PGM(DOR400/GL270A) QSYS/RTVDTAARA DTAARA(*LDA (9 6)) RTNVAR(&BOOK) QSYS/RTVDTAARA DTAARA(*LDA (15 1)) RTNVAR(&DIV) /* */ QSYS/OVRDBF FILE(GLTRAN) SHARE(*YES) QSYS/OPNQRYF FILE((DOR400/GLTRAN)) QRYSLT(' + GTBDTE *EQ ' *CAT &BOOK *CAT ' + *AND GTACCT *EQ 3120 + *AND GTSOUR *EQ "BI" + *AND GTDIV *EQ "' *CAT &DIV *TCAT '" + *OR GTBDTE *EQ ' *CAT &BOOK *CAT ' + *AND GTACCT *EQ 3140 + *AND GTSOUR *EQ "BI" + *AND GTDIV *EQ "' *CAT &DIV *TCAT '" + *OR GTBDTE *EQ ' *CAT &BOOK *CAT ' + *AND GTACCT *EQ 3150 + *AND GTSOUR *EQ "BI" + *AND GTDIV *EQ "' *CAT &DIV *TCAT '" + *OR GTBDTE *EQ ' *CAT &BOOK *CAT ' + *AND GTACCT *EQ 3170 + *AND GTSOUR *EQ "BI" + *AND GTDIV *EQ "' *CAT &DIV *TCAT '" + *OR GTBDTE *EQ ' *CAT &BOOK *CAT ' + *AND GTACCT *EQ 3190 + *AND GTSOUR *EQ "BI" + *AND GTDIV *EQ "' *CAT &DIV *TCAT '" + *OR GTBDTE *EQ ' *CAT &BOOK *CAT ' + *AND GTACCT *EQ 3300 + *AND GTSOUR *EQ "BI" + *AND GTDIV *EQ "' *CAT &DIV *TCAT '" + *OR GTBDTE *EQ ' *CAT &BOOK *CAT ' + *AND GTACCT *EQ 3120 + *AND GTSOUR *EQ "AR" + *AND GTDIV *EQ "' *CAT &DIV *TCAT '" + *OR GTBDTE *EQ ' *CAT &BOOK *CAT ' + *AND GTACCT *EQ 3140 + *AND GTSOUR *EQ "AR" + *AND GTDIV *EQ "' *CAT &DIV *TCAT '" + *OR GTBDTE *EQ ' *CAT &BOOK *CAT ' + *AND GTACCT *EQ 3150 + *AND GTSOUR *EQ "AR" + *AND GTDIV *EQ "' *CAT &DIV *TCAT '" + *OR GTBDTE *EQ ' *CAT &BOOK *CAT ' + *AND GTACCT *EQ 3170 + *AND GTSOUR *EQ "AR" + *AND GTDIV *EQ "' *CAT &DIV *TCAT '" + *OR GTBDTE *EQ ' *CAT &BOOK *CAT ' + *AND GTACCT *EQ 3190 + *AND GTSOUR *EQ "AR" + *AND GTDIV *EQ "' *CAT &DIV *TCAT '" + *OR GTBDTE *EQ ' *CAT &BOOK *CAT ' + *AND GTACCT *EQ 3300 + *AND GTSOUR *EQ "AR" + *AND GTDIV *EQ "' *CAT &DIV *TCAT '"') + KEYFLD((GTREF))
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.