Buck:

Why is writing a CL program messy?

Suppose the display had 5 fields called fld1, fld2, fld3, fld4, and fld5.
Suppose that each field was type character and contained a matching field -
the user could supply a blank or an "equal" value.  A CL program might be
coded to do the following:

pgm (&fld1 &fld2 &fld3 &fld4 &fld5 &qryslt)
declare statements ...
dcl &q *char 1 ''''

if (&fld1 *ne ' ') do
chgvar &qryslt ('fld1 = ')
chgvar &qryslt (&qryslt || &q || &fld1 || &q)
enddo

if (&fld2 *ne ' ') do
if (&qryslt = ' ') chgvar &qryslt ('fld2 = ')
else chgvar &qryslt (&qryslt |> '*and fld2 = ')
chgvar &qryslt (&qryslt || &q || &fld2 || &q || ' ')
enddo

and so forth.

If the search arguments might contain a generic character, detect the % or *
with a tiny RPG program and verify the argument syntax or detect with the
program and validate syntax using QCACHECK as you suggested.

I just wrote 40 percent of the basic program in 5 minutes.  I don't
understand why you think this will get ugly.

Richard Jackson
mailto:richardjackson@richardjackson.net
http://www.richardjacksonltd.com
Voice: 1 303 808 8058

-----Original Message-----
From: owner-midrange-l@midrange.com
[mailto:owner-midrange-l@midrange.com]On Behalf Of Buck Calabro
Sent: Monday, July 24, 2000 10:12 AM
To: MIDRANGE-L@midrange.com
Subject: RE: Opnqryf with Many Selections


Pat Barber wrote:

>I don't remember how many times
>I have been asked to do this,
>and I have never seen an reasonable
>way to handle it.
>
>Any or all of the parms can be entered,
>with the end result being a collection of
>"and" conditions.
>
>To make matters worse, "each" parm can be optional
>(no selection= print all). I have done this a couple
>of different ways using CLP and even RPG but I
>just wondered what other folks have come up with.
>I have never been happy with my methods.

"Reasonable" is such an interesting word.  A lot depends on the end-user.
If they're savvy, just give them a line to directly key the QRYSLT statement
on.  Validate it with QCAEXEC.  If the end-user needs a bit more
hand-holding then there's nothing to do but write an HLL program that
constructs the QRYSLT.  Oh, you could use CL but that would get messy pretty
quickly.

What have you used that you find less than satisfactory?  Perhaps you're
already doing it the "reasonable" way?

Buck Calabro
Aptis; Albany, NY
"We are what we repeatedly do.
 Excellence, then, is not an act, but a habit." --Aristotle


Billing Concepts Corp., a NASDAQ Listed Company, Symbol: BILL
+---
| 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 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
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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

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

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.