Hi, I am having problem with %CURDATE - please help!! OPNQRYF FILE((PHPACCT)) OPTION(*ALL) QRYSLT('ADMIT + *EQ %CURDATE') MAPFLD((DY AAMCY *CHAR 4) + (DM AAMMM *CHAR 2) (DD AAMDD *CHAR 2) + (ADMIT 'DY || DM || DD' *ZONED 8 0)) When I replace %CURDATE with 20090225 it works??? Below is the error log... thanks ERROR LOG Member CERTPF file CERTPF in BK#TEST cleared. 7900 - OVRDBF FILE(PHPACCT) TOFILE(*LIBL/PHPACCT) SHARE(*YES) 11300 - OPNQRYF FILE((PHPACCT)) OPTION(*ALL) QRYSLT('ADMIT *EQ %CURDATE') MAPFLD((DY AAMCY *CHAR 4) (DM AAMMM *CHAR 2) (DD AAMDD *CHAR 2) (ADMIT 'DY || DM || DD' *ZONED 8 0)) ************************************************** ******* ************************************************** ******* **** ERROR OCCURED ON CREATE CURSOR! **** ************************************************** ******* ************************************************** ******* =-=-= Start of Performance Messages Lvl: 01 =-=-= QQPERF - Implementation: Arrival Seq =-=-=-=-=- End of Performance Messages -=-=-=-=-= ************************************************** ******* 0004 04000000000000100000000000000000 '......... Field 0 in mapping template not valid when creatin Internal failure occurred in query processor.
Unconfigured Ad Widget
Collapse
Announcement
Collapse
No announcement yet.
OPNQRYF %CURDATE
Collapse
X
-
Re:OPNQRYF %CURDATE
The problem is that you are trying to compare a character field with a date field. You need to convert one of them to the other. I could show you how to do it with Query or SQL, but OpnQryF is a bit too out there for me. Bill
Comment
-
Re:OPNQRYF %CURDATE
Show us your new OpnQryF statement. According to my V5R2 materials, there's no specification qualifiers for which format is being fed to the %Date() option, so it should work without much of a change in your original statement. Bill
Comment
-
Re:OPNQRYF %CURDATE
The blurb below about %CURDATE should clue you in on the problem you're having. %CURDATE - It obtains the current date based on a reading of the time-of-day clock. The returned value is of type *DATE. The format and separator are derived from the job attributes. When you select records by hard-coding 20090225 it works because you are formatting ADMIT just as you expect it YYYYMMDD. So you get a hit because you are comparing a literal number to the zoned decimal number ADMIT. Two things: %CURDATE returns a date data-type. Implying the need for ADMIT to be of the same type. However I suspect the DATFMT from the job attributes is not in *ISO format with DATSEP *NONE like you have ADMIT formatted. Check the job attributes DATFMT and DATSEP first. Or you can run a test query throwing %CURDATE out so you can see the format of the date being returned. When you get there...It may be easier for you if you format ADMIT as character data and use the built-in %CHAR like this: %CHAR(%CURDATE) to return this "date" as character data. Good Luck. Tell us how you do.
Comment
Comment