Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Entering Dates on Query

11 views
Skip to first unread message

Scott Christopher

unread,
Nov 4, 2009, 12:59:31 PM11/4/09
to
I am on an i515 AS400, with OS400 V5R4.

I was wondering if it is possible to create a screen to enter a date,
and that information be used on multiple queries in a CL Program.

I was an RPG II programmer when we had a System 36. Now that we are
on the AS400 for 10 years, and I'm more of a System Administrator than
a programmer. I can write queries very well, it's just I don't know
all of the tricks that can be done to streamline programs and queries.

Thanks for any help or ideas you can offer.

Scott Christopher
IT Manager
Struthers-Dunn LLC

Dr.Ugo Gagliardelli

unread,
Nov 4, 2009, 2:06:17 PM11/4/09
to
il 04/11/2009 18.59, Scrive Scott Christopher 37948928:
Within a CL you cannot use any query that's not e predefined one, as
*QRYDFN or *QMQRY. With *QRYDFN you cannot pass any parameter while you
can with *QMQRY.
If you have SQL Toolkit installed (57xx-ST1) you can use QMQUERY, it's
very simple, just write in a source member your select statement and use
parameters within the where clause, e.g:
SELECT * FROM TABLE WHERE DATE = &DATE
Then create the query with CRTQMQRY using the source-file member, in a
CLP you cam run the query passing the &DATE parameter with command:
STRQMQRY qmqry_name SETVAR(('DATE' ''''' *tcat &DATE *tcat '''''))
assuming &DATE is a CLP defined variable containing a formatted date
with separators, while 'DATE' is the parameter declared inside the query
without the & character.

--
Dr.Ugo Gagliardelli,Modena,ItalyCertifiedUindoscrasherA�ejoAlcoolInside
Spaccamaroni andate a cagare/Spammers not welcome/Spammers v�o � merda
Spamers iros a la mierda/Spamers allez vous faire foutre/Spammers loop
schijten/Spammers macht Euch vom Acker/Spamerzy wypierdalac'

CRPence

unread,
Nov 5, 2009, 3:55:02 AM11/5/09
to

IIRC the SNDRCVF command, first having declared the display file
using DCLF to load the field-name variable into the program, is how
best to prompt for a date value. An inquiry message is another
method [e.g. SNDUSRMSG with MSGRPY(&variable)], but with no ability
to /create a screen/ for date validation in a field of a defined
length & data type. DDS is used to create the /screen/ to be
displayed; SDA [Screen Design Aid; STRSDA] optionally as the means
to generate the DDS and DSPF [Display File].

Regards, Chuck

Thomas

unread,
Nov 14, 2009, 8:39:05 PM11/14/09
to
Dr.Ugo Gagliardelli wrote:
> il 04/11/2009 18.59, Scrive Scott Christopher 37948928:
>> I am on an i515 AS400, with OS400 V5R4.
>>
>> I was wondering if it is possible to create a screen to enter a date,
>> and that information be used on multiple queries in a CL Program.
>>
>> I was an RPG II programmer when we had a System 36. Now that we are
>> on the AS400 for 10 years, and I'm more of a System Administrator than
>> a programmer. I can write queries very well, it's just I don't know
>> all of the tricks that can be done to streamline programs and queries.
>>
> Within a CL you cannot use any query that's not e predefined one, as
> *QRYDFN or *QMQRY. With *QRYDFN you cannot pass any parameter while you
> can with *QMQRY.

You can pass parm values into a *QRYDFN if it's been created to handle
them. The deal is that STRQMQRY ALWQRYDFN(*YES) must be used to run the
query.

--
Tom Liotta
http://zap.to/tl400

0 new messages