× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



This should work...you can reformat the chgvar however you want
it....I've already spent too much time on this...

 
             PGM

                DCL   VAR(&DIV) TYPE(*CHAR) LEN(1)  value('x')
                DCL   VAR(&BOOK) TYPE(*CHAR) LEN(6) value('bk')
                Dcl &qryslt *char 2000

                CHGVAR VAR(&QRYSLT) VALUE('GTBDTE *EQ "' *CAT &BOOK
*TCAT +
                         '" *AND GTACCT *EQ 3120 *AND GTSOUR *EQ "BI" +
                         *AND GTDIV *EQ "' *CAT &DIV *TCAT '" *OR GTBDTE
*EQ +
                        "' *CAT &BOOK *CAT '" *AND GTACCT *EQ 3140 *AND
+
                         GTSOUR *EQ "BI" *AND GTDIV *EQ "' *CAT &DIV +
                       *TCAT  '" *OR GTBDTE *EQ "' *CAT &BOOK *CAT '"
*AND +
                         GTACCT *EQ 3150 *AND GTSOUR *EQ "BI" *AND GTDIV
+
                        *EQ "' *CAT &DIV *TCAT '" *OR GTBDTE *EQ "' *CAT
+
                         &BOOK *CAT '" *AND GTACCT *EQ 3170 *AND GTSOUR
+
                         *EQ "BI" *AND GTDIV *EQ "' *CAT &DIV *TCAT '"
*OR +
                         GTBDTE *EQ "' *CAT &BOOK *CAT '"  *AND GTACCT
*EQ +
                         3190 *AND GTSOUR *EQ "BI" *AND GTDIV *EQ "'
*CAT  +
                        &DIV *TCAT '" *OR GTBDTE *EQ "' *CAT &BOOK *CAT
'" +
                         *AND GTACCT *EQ 3300 *AND GTSOUR *EQ "BI" *AND
+
                         GTDIV *EQ "' *CAT &DIV *TCAT '" *OR GTBDTE *EQ
"' +
                         *CAT &BOOK *CAT '"  *AND GTACCT *EQ 3120 *AND +
                         GTSOUR *EQ "AR" *AND GTDIV *EQ "' *CAT &DIV  +
                        *TCAT '" *OR GTBDTE *EQ "' *CAT &BOOK *CAT '"
*AND +
                         GTACCT *EQ 3140 *AND GTSOUR *EQ "AR" *AND GTDIV
+
                        *EQ "' *CAT &DIV *TCAT '" *OR GTBDTE *EQ "' *CAT
+
                         &BOOK *CAT '" *AND GTACCT *EQ 3150 *AND GTSOUR
+
                         *EQ "AR" *AND GTDIV *EQ "' *CAT &DIV *TCAT '"
*OR +
                         GTBDTE *EQ "' *CAT &BOOK *CAT '"  *AND GTACCT
*EQ +
                         3170 *AND GTSOUR *EQ "AR" *AND GTDIV *EQ "'
*CAT  +
                        &DIV *TCAT '" *OR GTBDTE *EQ "' *CAT &BOOK *CAT
'"  +
                         *AND GTACCT *EQ 3190 *AND GTSOUR *EQ "AR" *AND
+
                         GTDIV *EQ "' *CAT &DIV *TCAT '" *OR GTBDTE *EQ
"'  +
                         *CAT &BOOK *CAT '"  *AND GTACCT *EQ 3300 *AND +
                         GTSOUR *EQ "AR" *AND GTDIV *EQ "' *CAT &DIV
*tcat +
                         '"')
                OPNQRYF FILE((DOR400/GLTRAN)) QRYSLT(&qryslt)
KEYFLD((GTREF))

                          return
                          endpgm
 

Thanks,
Tommy Holden


-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of rick baird
Sent: Tuesday, August 22, 2006 9:37 AM
To: Midrange Systems Technical Discussion
Subject: Re: PROBLEM WITH OPNQRYF

or, based on the code you posted, this should work too.

CHGVAR &QSLT
VALUE('GTBDTE *EQ ' *CAT &BOOK *CAT +
 ' *AND GTDIV  *EQ "' *CAT &DIV *TCAT    +
'" *AND GTSOUR *EQ %VALUES("BI","AR")  +
   *AND GTACCT *EQ %VALUES(3120, 3140, 3150, 3170, 3170)')

this assumes of course these fields in your file, GTACCT and GTBDTE
are numeric, and GTDIV and GTSOUR are alpha.

compile with *srcdbg, then STRDBG OPMSRC(*yes), and step through the
CHGVAR and see what you get.

On 8/22/06, Bob O. <otis_the_cat@xxxxxxxxxxx> wrote:
  Ok Ken,

  I I added the quotes like you said.  When I run the program I am
still
  getting the CPF9899 error message saying that I'm missing an
operand.  I
  can't see where I'm missing anything.

               PGM

               QSYS/DCL   VAR(&DIV) TYPE(*CHAR) LEN(1)
               QSYS/DCL   VAR(&BOOK) TYPE(*CHAR) LEN(6)
  /*
*/
               QSYS/CALL  PGM(DOR400/GL270A)
               QSYS/RTVDTAARA DTAARA(*LDA (9 6)) RTNVAR(&BOOK)
               QSYS/RTVDTAARA DTAARA(*LDA (15 1)) RTNVAR(&DIV)
  /*
*/
               QSYS/OVRDBF FILE(GLTRAN) SHARE(*YES)

     QSYS/OPNQRYF FILE((DOR400/GLTRAN)) QRYSLT('                  +
                            GTBDTE *EQ ' *CAT &BOOK *CAT '        +
                            *AND GTACCT *EQ 3120                  +
                            *AND GTSOUR *EQ "BI"                  +
                            *AND GTDIV *EQ "' *CAT &DIV *TCAT '"  +
                          *OR GTBDTE *EQ ' *CAT &BOOK *CAT '      +
                            *AND GTACCT *EQ 3140                  +
                            *AND GTSOUR *EQ "BI"                  +
                            *AND GTDIV *EQ "' *CAT &DIV *TCAT '"  +
                          *OR GTBDTE *EQ ' *CAT &BOOK *CAT '      +
                            *AND GTACCT *EQ 3150                  +
                            *AND GTSOUR *EQ "BI"                  +
                            *AND GTDIV *EQ "' *CAT &DIV *TCAT '"  +
                          *OR GTBDTE *EQ ' *CAT &BOOK *CAT '      +
                            *AND GTACCT *EQ 3170                  +
                            *AND GTSOUR *EQ "BI"                  +
                            *AND GTDIV *EQ "' *CAT &DIV *TCAT '"  +
                          *OR GTBDTE *EQ ' *CAT &BOOK *CAT '      +
                            *AND GTACCT *EQ 3190                  +
                            *AND GTSOUR *EQ "BI"                  +
                            *AND GTDIV *EQ "' *CAT &DIV *TCAT '"  +
                          *OR GTBDTE *EQ ' *CAT &BOOK *CAT '      +
                            *AND GTACCT *EQ 3300                  +
                            *AND GTSOUR *EQ "BI"                  +
                            *AND GTDIV *EQ "' *CAT &DIV *TCAT '"  +
                          *OR GTBDTE *EQ ' *CAT &BOOK *CAT '      +
                            *AND GTACCT *EQ 3120                  +
                            *AND GTSOUR *EQ "AR"                  +
                            *AND GTDIV *EQ "' *CAT &DIV *TCAT '"  +
                          *OR GTBDTE *EQ ' *CAT &BOOK *CAT '      +
                            *AND GTACCT *EQ 3140                  +
                            *AND GTSOUR *EQ "AR"                  +
                            *AND GTDIV *EQ "' *CAT &DIV *TCAT '"  +
                          *OR GTBDTE *EQ ' *CAT &BOOK *CAT '      +
                            *AND GTACCT *EQ 3150                  +
                            *AND GTSOUR *EQ "AR"                  +
                            *AND GTDIV *EQ "' *CAT &DIV *TCAT '"  +
                          *OR GTBDTE *EQ ' *CAT &BOOK *CAT '      +
                            *AND GTACCT *EQ 3170                  +
                            *AND GTSOUR *EQ "AR"                  +
                            *AND GTDIV *EQ "' *CAT &DIV *TCAT '"  +
                          *OR GTBDTE *EQ ' *CAT &BOOK *CAT '      +
                            *AND GTACCT *EQ 3190                  +
                            *AND GTSOUR *EQ "AR"                  +
                            *AND GTDIV *EQ "' *CAT &DIV *TCAT '"  +
                          *OR GTBDTE *EQ ' *CAT &BOOK *CAT '      +
                            *AND GTACCT *EQ 3300                  +
                            *AND GTSOUR *EQ "AR"                  +
                            *AND GTDIV *EQ "' *CAT &DIV *TCAT '"') +
                            KEYFLD((GTREF))






----------------------------------------------------------------------

    From:  "rick baird" <rick.baird@xxxxxxxxx>
    Reply-To:  Midrange Systems Technical Discussion
    <midrange-l@xxxxxxxxxxxx>
    To:  "Midrange Systems Technical Discussion"
<midrange-l@xxxxxxxxxxxx>
    Subject:  Re: PROBLEM WITH OPNQRYF
    Date:  Fri, 18 Aug 2006 16:47:08 -0400
    >Ken, exactly.
    >
    >and just to clarify, the CL variable (&DIV) must be an alpha
variable
    >to concatenate, regardless if the file variable is alpha or
numeric.
    >
    >On 8/18/06, Ken Sims <mdrg5003@xxxxxxxxxxx> wrote:
    > > Hi Bob -
    > >
    > > >   First off, I thought *CAT is used only for numeric
    variable.  &DIV is a
    > > >    one character field as is the GTDIV field in the file.
    > > >
    > > >    Second, If I take out the lines with:
    > > >
    > > >    *AND GTDIV *EQ &DIV
    > >
    > > You have to use *CAT (or *BCAT or *TCAT) for any kind of
variable so
    that
    > > the contents of the variable are substituted into the select.
    > >
    > > Numeric:
    > >
    > > ... *AND FIELD *EQ ' *CAT &NUMBER *CAT ' ...
    > >
    > > Character:
    > >
    > > ... *AND FIELD *EQ "' *CAT &ALPHA *CAT '" ...
    > >
    > > Note the double quotes on either side of the concatenated
value for
    > > character fields.  You could also use a pair of single quotes
but
    the
    > > double quotes are much nicer to work with.
    > >
    > > Ken
    > > http://www.kensims.net/
    > > Opinions expressed are my own and do not necessarily represent
the
    views
    > > of my employer or anyone in their right mind.
    > >
    > > --
    > > This is the Midrange Systems Technical Discussion (MIDRANGE-L)
    mailing list
    > > To post a message email: MIDRANGE-L@xxxxxxxxxxxx
    > > To subscribe, unsubscribe, or change list options,
    > > visit: http://lists.midrange.com/mailman/listinfo/midrange-l
    > > or email: MIDRANGE-L-request@xxxxxxxxxxxx
    > > Before posting, please take a moment to review the archives
    > > at http://archive.midrange.com/midrange-l.
    > >
    > >
    >--
    >This is the Midrange Systems Technical Discussion (MIDRANGE-L)
mailing
    list
    >To post a message email: MIDRANGE-L@xxxxxxxxxxxx
    >To subscribe, unsubscribe, or change list options,
    >visit: http://lists.midrange.com/mailman/listinfo/midrange-l
    >or email: MIDRANGE-L-request@xxxxxxxxxxxx
    >Before posting, please take a moment to review the archives
    >at http://archive.midrange.com/midrange-l.
    >
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.