• Subject: RE: QMQRY question
  • From: Buck Calabro <mcalabro@xxxxxxxxxxxx>
  • Date: Mon, 19 Jul 1999 14:10:51 -0400

Dennis,
You've done 99% of the detective work, and are almost there!

Think of an *ISO date as a character field (even though it's not.)  The
variable that you need to pass must look like '1999-01-01'  If you
dump/debug the failing version, you will see 1999-01-01 - no quote marks.
In order to include the single quotes inside your variable, you need to
place two of them side-by-side.  In order to tell the CL program that you
are specifying a character literal, you need to enclose the lot inside
single quotes.  This will result in a silly-looking triplet of single
quotes: '''1999-01-01'''

I think of it this way: One tick mark to denote "begin char literal", two
tick marks to denote "single quote", then the literal I need, then two tick
marks to denote "single quote", then one tick mark to denote "end char
literal"  

This is generic to dealing with any character string, not just *ISO format
dates.
I hope this helps.

Buck Calabro
Billing Concepts Albany, NY
mailto:mcalabro@commsoft.net

> -----Original Message-----
> From: Dennis Munro 
> Sent: Monday, July 19, 1999 1:02 PM
> To:   'Midrange Users'
> Subject:      QMQRY question
> 
> I am having trouble getting a STRQMQRY query/form with variables to work
> within a CL program.  There is a sample in the DB2 for AS/400 Query
> Management Programming book using numeric & character variables but my
> variable is a date field defined as *ISO Type L in the DDS.  I have a
> "from"
> and "thru" date I am entering to pick out the date range of transactions I
> want to print.
> 
> Running the query interactively & entering the variables as 19990601 &
> 19990630 gives me the error "Comparison operator >= operands not
> compatible".
> 
> Running the query interactively & entering the variables as '19990601' &
> '19990630' gives me the error "Syntax of date, time, or timestamp value
> not
> valid".
> 
> Running the query interactively & entering the variables as '1999-06-01' &
> '1999-06-30' and it works just fine.  So I CHGVAR in the CL program to get
> to this format and it still fails. The book talks about extra quotes being
> needed but doesn't tell you why so I keep running the CL and Dumping the
> variables when it fails but I still can't get it to work.<NAVBG>
> 
+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 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 here. If you have questions about this, please contact [javascript protected email address].