PDA

View Full Version : OPNQRYF and date ranges



David Abramowitz
03-15-2004, 09:16 AM
It's important to know if "OSDATE" is defined as numeric or alpha. Dave

B.Bardini
03-30-2004, 11:02 AM
Hi Larry. I'm thinking that because you're using the %DIGITS function to convert your date, your database field is numeric. The %DIGITS function converts a numeric to a character field. So, on your select statement, I think you need some double quotes around your two dates. I copied your OPNQRYF statement into the code section, and added the double quotes to where I think they should go. I believe that your OPNQRYF statement needs to look like the second code section. Only difference is the double quotes around the two dates. Try running the OPNQRYF statement with the double quotes, and see if that works for you. Let me know if this helps. Bruce <hr width=50 align=left>Code ('http://www.mcpressonline.com/mc/showcode@@.6ae9da7c/1')

lls_51@yahoo.com
03-30-2004, 11:05 AM
Subject: OPNQRYF and date ranges I'm having a problem selecting data via OPNQRYF using a date range. Here is the C/L. Definition for OS2008 is: PACKED 8 0 PGM DCL VAR(&CDATE8) TYPE(*CHAR) LEN(8) + VALUE('20040315') DCL VAR(&DATE8) TYPE(*CHAR) LEN(8) + VALUE('20040305') OVRDBF FILE(OS020PF) TOFILE(OPTISPOOLD/OS020PF) OPNQRYF FILE((OPTISPOOLD/OS020PF)) + QRYSLT('OSDATE *EQ + %RANGE(' *CAT &DATE8 *CAT ' ' *CAT &CDATE8 *CAT ')') + MAPFLD((OSDATE '%DIGITS(OS2008)')) CPYFRMQRYF FROMOPNID(OS020PF) TOFILE(LLSLIB/OS020PF) + MBROPT(*REPLACE) FMTOPT(*NOCHK) CLOF OPNID(OS020PF) ENDPGM ERROR message: CALL QRYOS020XX 600 - OVRDBF FILE(OS020PF) TOFILE(OPTISPOOLD/OS020PF) 700 - OPNQRYF FILE((OPTISPOOLD/OS020PF)) QRYSLT('OSDATE *EQ %RANGE(20040305 20040315)') MAPFLD((OSDATE '%DIGITS(OS2008)')) Operand for %RANGE function not valid. Error occurred during processing of command. Function check. CPF9899 unmonitored by QRYOS020XX at statement 700, instruction X'001B'. CPF9899 received by QRYOS020XX at 700. (C D I R) CPF9899 received by QRYOS020XX at 700. (C D I R) Any suggestions are appreciated. Larry Swain lls_51@yahoo.com