build opnqryf with parms in CL - IBM AS400

This is a discussion on build opnqryf with parms in CL - IBM AS400 ; This works: OPNQRYF FILE((EQP0010)) QRYSLT(&QRYSLT) + KEYFLD((&KEY1) (&KEY2) (&KEY3) (&KEY4)) + MAPFLD((ENTD@ DEALDT *CHAR 8) (PROD# PROD + *CHAR 2)) what I can't find any info on is the mapfld parm. How do I handle the mapfld with variables like ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: build opnqryf with parms in CL

  1. build opnqryf with parms in CL

    This works:

    OPNQRYF FILE((EQP0010)) QRYSLT(&QRYSLT) +
    KEYFLD((&KEY1) (&KEY2) (&KEY3) (&KEY4)) +
    MAPFLD((ENTD@ DEALDT *CHAR 8) (PROD# PROD +
    *CHAR 2))

    what I can't find any info on is the mapfld parm. How do I handle the
    mapfld with variables like I did with the keyfld parm?

    Thanks,
    Brian


  2. Re: build opnqryf with parms in CL


    shopping@datawhouse.com wrote:
    > This works:
    >
    > OPNQRYF FILE((EQP0010)) QRYSLT(&QRYSLT) +
    > KEYFLD((&KEY1) (&KEY2) (&KEY3) (&KEY4)) +
    > MAPFLD((ENTD@ DEALDT *CHAR 8) (PROD# PROD +
    > *CHAR 2))
    >
    > what I can't find any info on is the mapfld parm. How do I handle the
    > mapfld with variables like I did with the keyfld parm?


    how do you want to use the mapflds? They can be used within the
    opnqryf command by qualifying them with *MAPFLD. You can output them
    with other input fields by defining a record format in the FORMAT parm.
    That format then has to match the format of the file you use OVRDBF on
    to override to the output of OPNQRYF. At least that is the way I
    remember it. OPNQRYF is rarely used for new code nowadays.

    -Steve


  3. Re: build opnqryf with parms in CL

    Thanks Steve, what I'm trying to do is chop a CL down from 12 opnqryf
    's into 1 generic that I can build. I have the &QRYSLT working
    correctly and the KEYFLD correctly. My problem is how to use a variable
    in the MAPFLD parm that I can change on the fly with a chgvar.
    Thanks again for the help,
    brian


  4. Re: build opnqryf with parms in CL


    shopping@datawhouse.com wrote:
    > Thanks Steve, what I'm trying to do is chop a CL down from 12 opnqryf
    > 's into 1 generic that I can build. I have the &QRYSLT working
    > correctly and the KEYFLD correctly. My problem is how to use a variable
    > in the MAPFLD parm that I can change on the fly with a chgvar.
    > Thanks again for the help,
    > brian


    Build the whole thing into a string, and execute it with QCMDEXC.

    I don't think you're going to be able to do what you want executing
    OPNQRYF directly.

    Chris
    --
    chris@pando.org
    www.brilligware.com
    Home of MineSweeper5250!


  5. Re: build opnqryf with parms in CL

    I found out how to do it:

    original:

    /* OPNQRYF FILE((EQP0010)) QRYSLT(&QRYSLT) + */
    /* KEYFLD((&KEY1) (&KEY2) (&KEY3) (&KEY4)) + */
    /* MAPFLD((ENTD@ DEALDT *CHAR 8) (PROD# + */
    /* PROD *CHAR 2)) */


    variabled:

    CHGVAR VAR(&MAP1) VALUE('DEALDT')

    CHGVAR VAR(&MAP2) VALUE('PROD')

    OPNQRYF FILE((EQP0010)) QRYSLT(&QRYSLT) +

    KEYFLD((&KEY1) (&KEY2) (&KEY3) (&KEY4)) +

    MAPFLD((ENTD@ &MAP1 *CHAR 8) (PROD# &MAP2 +

    *CHAR 2))

    Thanks for all the help!!!
    Brian


+ Reply to Thread