Unconfigured Ad Widget

Collapse

Announcement

Collapse
No announcement yet.

Syntax question for QPNQRYF command in CLP

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

  • Syntax question for QPNQRYF command in CLP

    Try this: OPNQRYF FILE((APPINVE)) QRYSLT('DIV = %VALUES("35" "46") *and DSBDAT = %RANGE(' *tcat &RANGE1 *tcat ' ' *tcat &RANGE2 *tcat ') *and MODIFY *EQ "P"') KEYFLD((DIV) (VEND#) (DSBDAT))

  • #2
    Syntax question for QPNQRYF command in CLP

    I thank you for your help but it is still not working. It won't even compile now. Here is the compile listing. OVRDBF FILE(APPINVE) SHARE(*YES) OPNQRYF FILE((APPINVE)) QRYSLT('DIV = %VALUES("35" + "46") *and DSBDAT = %RANGE(' *TCAT + &RANGE1 *TCAT ' ' *TCAT &RANGE2 *TCAT ') + *and MODIFY *EQ "P"') KEYFLD((DIV) + (VEND#) (DSBDAT))[*] CPD0712 30 Operand does not have valid type for operator.[*] CPD0711 30 Operands in expression not same type.[*] CPD0712 30 Operand does not have valid type for operator.[*] CPD0711 30 Operands in expression not same type.

    Comment


    • #3
      Syntax question for QPNQRYF command in CLP

      Are &range1 and &range2 character variables? Within the QRYSLT parenthese, you are in essence building a string. What I usually do is create a variable called &qryslt type *char length 200. (can be any length needed). I will include some sample code that I have in producation. In the code &bdate &
      Code

      Comment


      • #4
        Syntax question for QPNQRYF command in CLP

        Two ways to debug CL statements:
        1. Insert a DMPCLPGM command into the program.
        2. Run the program in batch logging all CL commands, and specifying *SECLVL for the log detail.
        Dave

        Comment


        • #5
          Syntax question for QPNQRYF command in CLP

          You may try date range as: OPNQRYF FILE((IPPINVE)) QRYSLT('(.... *AND DSBDAT *EQ %RANGE("' *CAT &Range1 *CAT '"' *BCAT '"' *CAT &Range2 *CAT '")*AND......)') Note that Range1, 2 are character values. If DSBDAT is numeric, you need use MAPFLD option to convert it to character value.

          Comment


          • #6
            Syntax question for QPNQRYF command in CLP

            here is what I need. DIV = 35 or 46 both are 2 position character strings DSBDAT = Range (&Range1 &Range2) DSBDAT is numeric in the file I am querying but the variables that I am building the string can be character to make it easier to build the string. So &Range1 and &Range2 will be 8 position Character The a field MODIFY = "P" a one position Character code So however the statement needs to be written DIV = %Values("35" "46") and DSBDAT = %Range(&Range1 &Range2) and MODIFY = "P" I have a open queryfile book and have also tried to create the QRYSLT statment as previously described but because of the the complication because of the use of values and range I can't get the syntax correct. And I can't find an example of this. I find examples of the individual selection criteria but not this peticular one. Sorry to be such a bother, but I am trying to do the research to get it correct and also trying different interperetations of the examples I am looking at to try to get it to work. Thanks for everyones help and hopefully by restating this, my specific example might be able to be recreated correctly. Thanks

            Comment


            • #7
              Syntax question for QPNQRYF command in CLP

              Try this: notice using the *bcat in one place. The *tcat strips the middle space between the ranges. Also ensure you are using "*and" not just "and" Hope this helps.
              Code

              Comment


              • #8
                Syntax question for QPNQRYF command in CLP

                Testing it now. It looks like it is running and no job log this time. I will determine if it needs tweaked. I will then apply what I have learned in the future. Thank you very much. Happy holidays.

                Comment


                • #9
                  Syntax question for QPNQRYF command in CLP

                  I am trying to insert a date parameter in a QPNQRYF statement in CLP and am getting an error "Argument on QRYSLT parameter starts with &." Here is the statement. OPNQRYF FILE((APPINVE)) QRYSLT('DIV = %VALUES("35" "46") *and DSBDAT = %RANGE(&RANGE1 &RANGE2) *and MODIFY *EQ "P"') KEYFLD((DIV) (VEND#) (DSBDAT)) The &RANGE1 and &RANGE2 are date variables brought into the program. If I just hardcode the date range it works but I need the variables. Can anyone help with the syntax. Thanks

                  Comment


                  • #10
                    Syntax question for QPNQRYF command in CLP

                    I too have had lots of trouble with qryslt paramters. I still do, even after having read 2 books about it. It seems your error is using alpha fields to select a numeric range. This has just happened to me. I have just recently gotten a query working with range. The selection field is numeric, the 2 range fields alpha. It has to do with the number of quotes surrounding the range fields. If it resolves to : field *eq %range("11111" "22222") then you will get an error. It must resolve to field *eq %range(11111 22222). check how you many quotes you use. My code show below works for me. ---Dale
                    Code

                    Comment

                    Working...
                    X