Unconfigured Ad Widget

Collapse

Announcement

Collapse
No announcement yet.

OPNQRYF %CURDATE

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • OPNQRYF %CURDATE

    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.

  • #2
    Re:OPNQRYF %CURDATE

    Have you tried mapping your field to *CHAR, instead of *ZONED? Dave

    Comment


    • #3
      Re:OPNQRYF %CURDATE

      Dave, thanks for your response; no, it did not work..

      Comment


      • #4
        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


        • #5
          Re:OPNQRYF %CURDATE

          Leave it as *CHAR and then compare it as %date(admit). You may have to insert separators within the date. Dave

          Comment


          • #6
            Re:OPNQRYF %CURDATE

            did not work...

            Comment


            • #7
              Re:OPNQRYF %CURDATE

              You may want to try using the DMPCLPGM command immediately after the OPNQRYF. Also change the job to second level logging. This way you can inspect the job log for the values used in the OPNQRYF command. Dave

              Comment


              • #8
                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


                • #9
                  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

                  Working...
                  X