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

QRYSLT EXPRESSION HELP

191 views
Skip to first unread message

Daniel W. Exum

unread,
Aug 17, 1999, 3:00:00 AM8/17/99
to
I need help with QRYSLT expression.
DCL Var(&QRYSLT) TYPE(*CHAR) LEN(256)
DCL Var(&PDATE) TYPE(*DEC) LEN(7 0)
DCL Var(&EDATE) TYPE(*DEC) LEN(7 0)

CHGVAR VAR(QRYSLT) VALUE('DATE *EQ %RANGE(&PDATE &EDATE)

OPNQRY FILE(FILE) QRYSLT(&QYRSLT) ....

Gernot B Längle

unread,
Aug 17, 1999, 3:00:00 AM8/17/99
to
You need to end up with &QRYSLT containing the actual data; e.g. if
&PDATE is 0990801 and &EDATE is 0991231 the &QRYSLT should be: 'DATE *EQ
%RANGE(0990801 0991231)'.

--
Gernot Langle
PARAS Solutions, Inc.
http://www.parassolutions.com
mailto:gla...@parassolutions.com

Daniel W. Exum

unread,
Aug 17, 1999, 3:00:00 AM8/17/99
to
THANKS. BUT I NEED TO PASS VARIABLES FROM A DISPLAY FILE SO I CANNOT HARD
CODE IN JULIAN DATES. THE SCREEN ACCEPTS DATE IN MMDDYY FORMAT THEN I
CONVERT THEM TO JULIAN. I THEN NEED TO SELECT RECORDS WITH JULIAN DATE IN
RANGE OF INPUT DATES.
Gernot B Längle wrote in message <37B97948...@tc.umn.edu>...

Judi Martin

unread,
Aug 17, 1999, 3:00:00 AM8/17/99
to
1. Need to concatenate the variable fields into the alpha expression
string.
2. Need to move the decimal variables into character variables in order to
do the concatenate.
3. Offhand can't remember whether you need the *bcat to place a blank
between the two variables but I think so.
CHGVAR VAR(QRYSLT) VALUE('DATE *EQ %RANGE(' *cat &PDATEC *bcat &EDATEC *cat
')')

Hope this helps,
Judi

Daniel W. Exum

unread,
Aug 17, 1999, 3:00:00 AM8/17/99
to
Worked great thanks for help. Now could you help me select only records
that the last two characters are "&FLT" in 6 character field.

&FLT *CHAR *LEN(2)

INPUT FROM DISPLAY &FLT MAY BE "ME', "LH", etc.
NEED QRYSLT TO SUBSTR LAST TWO CHARACTERS IN 6 CHAR FIELD FROM DATABASE AND
SELECT IF EQ &FLT

Christian Luebke

unread,
Aug 17, 1999, 3:00:00 AM8/17/99
to
> I need help with QRYSLT expression.
> DCL Var(&QRYSLT) TYPE(*CHAR) LEN(256)
> DCL Var(&PDATE) TYPE(*DEC) LEN(7 0)
> DCL Var(&EDATE) TYPE(*DEC) LEN(7 0)

DCL &PDATEC *CHAR 7
DCL &EDATEC *CHAR 7

CHGVAR &PDATEC &PDATE
CHGVAR &PDATEC &PDATE

> CHGVAR VAR(QRYSLT) VALUE('DATE *EQ %RANGE(&PDATE &EDATE)

Use this:
CHGVAR &QRYSLT ('DATE *EQ %RANGE(' *CAT &PDATEC *BCAT &EDATEC *CAT ')')

> OPNQRY FILE(FILE) QRYSLT(&QYRSLT) ....

Hope it helps
Bye, Christian

Judi Martin

unread,
Aug 18, 1999, 3:00:00 AM8/18/99
to
You could try this:
CHGVAR VAR(QRYSLT) VALUE('FIELD *EQ %WLDCRD("%' *cat &FLT *cat'")')
It should come out as FIELD *EQ %WLDCRD("%ME")

hth,
Judi

Daniel W. Exum wrote in message ...

Charles R. Pence

unread,
Aug 18, 1999, 3:00:00 AM8/18/99
to
Daniel W. Exum wrote:
> Worked great thanks for help. Now could you help me select only records
> that the last two characters are "&FLT" in 6 character field.
>
> &FLT *CHAR *LEN(2)
>
> INPUT FROM DISPLAY &FLT MAY BE "ME', "LH", etc.
> NEED QRYSLT TO SUBSTR LAST TWO CHARACTERS IN 6 CHAR FIELD FROM DATABASE AND
> SELECT IF EQ &FLT

Need for given sample data "ME": qryslt('%sst(Char6Field 5 2) *eq "ME"')
Use: CHGVAR &SLT VALUE('%sst(Char6Field 5 2) *EQ "' *cat &FLT *cat '")')
Note: the %sst() is the query function, not the CL function

Regards, Chuck
All comments provided "as is" with no warranties of any kind whatsoever.

Thomas

unread,
Aug 19, 1999, 3:00:00 AM8/19/99
to
Judi:

This would work okay under two conditions. First, you'd need to specify
that <%> was being used as the substring wildcard character -- an
asterisk <*> is the default. Second, it would match any time the last
two non-blank characters were <ME> if &FLT='ME'.

However, if you wanted to match _only_ against positions 5 and 6 of a
*CHAR 6 field, you should use:

VALUE('FIELD *EQ %WLDCRD(''____' *cat &FLT *cat ''')')

Use four underscores to make the first four positions match any
characters.

Tom Liotta


In article <WpHu3.344$jp4....@news.uswest.net>,


"Judi Martin" <bri...@juno.com> wrote:
> You could try this:
> CHGVAR VAR(QRYSLT) VALUE('FIELD *EQ %WLDCRD("%' *cat &FLT *cat'")')
> It should come out as FIELD *EQ %WLDCRD("%ME")
>
> hth,
> Judi
>
> Daniel W. Exum wrote in message ...

> > Worked great thanks for help. Now could you help me select only
records
> >that the last two characters are "&FLT" in 6 character field.
> >
> >&FLT *CHAR *LEN(2)
> >
> >INPUT FROM DISPLAY &FLT MAY BE "ME', "LH", etc.
> >NEED QRYSLT TO SUBSTR LAST TWO CHARACTERS IN 6 CHAR FIELD FROM
DATABASE AND
> >SELECT IF EQ &FLT
> >
> >
>
>

--
Tom Liotta
AS/400 systems programmer


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.

Charles R. Pence

unread,
Aug 19, 1999, 3:00:00 AM8/19/99
to
Thomas wrote:
>> "Judi Martin" <bri...@juno.com> wrote:
>> You could try this:
>> CHGVAR VAR(QRYSLT) VALUE('FIELD *EQ %WLDCRD("%' *cat &FLT *cat'")')
>> It should come out as FIELD *EQ %WLDCRD("%ME")
> This would work okay under two conditions. First, you'd need to specify
> that <%> was being used as the substring wildcard character -- an
> asterisk <*> is the default. Second, it would match any time the last
> two non-blank characters were <ME> if &FLT='ME'.
>
> However, if you wanted to match _only_ against positions 5 and 6 of a
> *CHAR 6 field, you should use:
>
> VALUE('FIELD *EQ %WLDCRD(''____' *cat &FLT *cat ''')')
>
> Use four underscores to make the first four positions match any
> characters.

I believe the second is a concern only for a variable-length column,
but for a fixed-length column, blanks are significant. As such
the selection 'FIELD *EQ %WLDCRD("*ME")' on a fixed-length column
would match only when the last two characters were 'ME'; not the
last two non-blanks.

In either case the comparison value '*ME' is different than '*ME ';
the latter requires the blank for a selection <not probable with a
varying-length string>, the former requires there is no blank.

Regardless, to be clear on intentions with such a selection coded
in a program, I would choose to compare only the two bytes of interest
by use of %sst.

Judi Martin

unread,
Aug 19, 1999, 3:00:00 AM8/19/99
to

Charles R. Pence wrote in message <37BBF8B...@vnet.ibm.com>...

>> asterisk <*> is the default.
Sorry, I should have mentioned I was unsure of the correct character for the
wildcard.

VALUE('FIELD *EQ %WLDCRD("*' *cat &FLT *cat '")') matches any fixed or
variable length field ending in ME (as example).
VALUE('FIELD *EQ %WLDCRD(''____' *cat &FLT *cat ''')') matches any fixed
length 6 character field ending in ME.
VALUE('%sst(Char6Field 5 2) *EQ "' *cat &FLT *cat '")') matches any fixed or
variable length field containing ME at positions 5 and 6.

I will agree the last is most clear, altho in this instance any of the three
should work.

Judi

Thomas

unread,
Aug 20, 1999, 3:00:00 AM8/20/99
to
Chuck:

I'd sure like to meet you someday. You ever get to COMMON or elsewhere?
If you get close to retiring or getting out of the AS/400 business,
would you send an early warning to us? You'll be missed.

Tom Liotta


In article <37BBF8B...@vnet.ibm.com>,


"Charles R. Pence" <crp...@vnet.ibm.com> wrote:
> Thomas wrote:
> >> "Judi Martin" <bri...@juno.com> wrote:
> >> You could try this:

> >> CHGVAR VAR(QRYSLT) VALUE('FIELD *EQ %WLDCRD("%' *cat &FLT
*cat'")')


> >> It should come out as FIELD *EQ %WLDCRD("%ME")
> > This would work okay under two conditions. First, you'd need to
specify
> > that <%> was being used as the substring wildcard character -- an
> > asterisk <*> is the default. Second, it would match any time the
last
> > two non-blank characters were <ME> if &FLT='ME'.
> >
> > However, if you wanted to match _only_ against positions 5 and 6 of
a
> > *CHAR 6 field, you should use:
> >

> > VALUE('FIELD *EQ %WLDCRD(''____' *cat &FLT *cat ''')')
> >

> > Use four underscores to make the first four positions match any
> > characters.
>
> I believe the second is a concern only for a variable-length column,
> but for a fixed-length column, blanks are significant. As such
> the selection 'FIELD *EQ %WLDCRD("*ME")' on a fixed-length column
> would match only when the last two characters were 'ME'; not the
> last two non-blanks.
>
> In either case the comparison value '*ME' is different than '*ME ';
> the latter requires the blank for a selection <not probable with a
> varying-length string>, the former requires there is no blank.
>
> Regardless, to be clear on intentions with such a selection coded
> in a program, I would choose to compare only the two bytes of interest
> by use of %sst.
>
> Regards, Chuck
> All comments provided "as is" with no warranties of any kind
whatsoever.
>

--

0 new messages