CL: Convert char variable (from file) to VariableList ? - IBM AS400

This is a discussion on CL: Convert char variable (from file) to VariableList ? - IBM AS400 ; I want use DSPJRN. Parameter ENTTYP is Variable List and I want write it in file Config file AAUDP/CONF3: CD AF Source CLLE: DCLF FILE(AAUDP/CONF3) DSPJRN JRN(QAUDJRN) USRPRF(user) FROMTIME(05012005) + ENTTYP(&CONF3) /* - Error values CD AF */ CHGVAR VAR(&TMPVAR) ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: CL: Convert char variable (from file) to VariableList ?

  1. CL: Convert char variable (from file) to VariableList ?

    I want use DSPJRN. Parameter ENTTYP is Variable List and I want write
    it in file

    Config file AAUDP/CONF3: CD AF

    Source CLLE:
    DCLF FILE(AAUDP/CONF3)

    DSPJRN JRN(QAUDJRN) USRPRF(user) FROMTIME(05012005) +
    ENTTYP(&CONF3) /* - Error values CD AF */

    CHGVAR VAR(&TMPVAR) VALUE(%SUBSTRING(&CONF3 1 2)) /*CD*/
    CHGVAR VAR(&TMPVAR2) VALUE(%SUBSTRING(&CONF3 4 2)) /*AF*/

    DSPJRN JRN(QAUDJRN) USRPRF(user) FROMTIME(05012005) +
    ENTTYP(&TMPVAR &TMPVAR2) - OK

    Values ENTTYP can be 500, so I need 500 variables?
    How works system commend DSPJRN (where can I find source of it?), also
    need 500 variables?


  2. Re: CL: Convert char variable (from file) to VariableList ?

    AFaIK, for list elements, separate CL variable is required for each.
    So in the given case, as many variables as values, as required to
    accomplish the task.
    The easiest way to deal with such issues is to instead:
    - use QCMDEXC [or QCAPCMD] with a concatenated string with CLP [or
    any HLL with a call to similar, or with a system() type of interface --
    to pass a string as a CL command invocation]
    - use REXX *COMMAND environment instead of a CLP
    - use an API to get the journal data instead of the CL command DSPJRN

    There are also the deprecated DSPAUDJRNE specific to auditing, and
    its replacement CPYAUDJRNE; see Chapter 9 of the Security Reference
    manual and http://archive.midrange.com/midrange.../msg00749.html

    Regards, Chuck
    --
    All comments provided "as is" with no warranties of any kind
    whatsoever and may not represent positions, strategies, nor views of my
    employer

    Greg102 wrote:
    > I want use DSPJRN. Parameter ENTTYP is Variable List and I want write
    > it in file
    >
    > Config file AAUDP/CONF3: CD AF
    >
    > Source CLLE:
    > DCLF FILE(AAUDP/CONF3)
    >
    > DSPJRN JRN(QAUDJRN) USRPRF(user) FROMTIME(05012005) +
    > ENTTYP(&CONF3) /* - Error values CD AF */
    >
    > CHGVAR VAR(&TMPVAR) VALUE(%SUBSTRING(&CONF3 1 2)) /*CD*/
    > CHGVAR VAR(&TMPVAR2) VALUE(%SUBSTRING(&CONF3 4 2)) /*AF*/
    >
    > DSPJRN JRN(QAUDJRN) USRPRF(user) FROMTIME(05012005) +
    > ENTTYP(&TMPVAR &TMPVAR2) - OK
    >
    > Values ENTTYP can be 500, so I need 500 variables?
    > How works system commend DSPJRN (where can I find source of it?), also
    > need 500 variables?


  3. Re: CL: Convert char variable (from file) to VariableList ?

    Greg102 wrote:
    > I want use DSPJRN. Parameter ENTTYP is Variable List and I want write
    > it in file
    >
    > Config file AAUDP/CONF3: CD AF
    >
    > Source CLLE:
    > DCLF FILE(AAUDP/CONF3)
    >
    > DSPJRN JRN(QAUDJRN) USRPRF(user) FROMTIME(05012005) +
    > ENTTYP(&CONF3) /* - Error values CD AF */
    >
    > CHGVAR VAR(&TMPVAR) VALUE(%SUBSTRING(&CONF3 1 2)) /*CD*/
    > CHGVAR VAR(&TMPVAR2) VALUE(%SUBSTRING(&CONF3 4 2)) /*AF*/
    >
    > DSPJRN JRN(QAUDJRN) USRPRF(user) FROMTIME(05012005) +
    > ENTTYP(&TMPVAR &TMPVAR2) - OK
    >
    > Values ENTTYP can be 500, so I need 500 variables?
    > How works system commend DSPJRN (where can I find source of it?), also
    > need 500 variables?


    Chuck has already answered, but I want to add an additional element.

    It's unusual to ever need all of the possible 2-character entry types.
    However, there are often times when a variable number of types are needed.

    The 'list elements' don't support any useful way to supply null values
    or blanks. Actual valid values must be supplied for each position that
    you use in a CL program when the command is compiled. I.e., if you code
    the command to allow 20 entry types, then you must supply 20 valid
    values. As chuck noted, the command doesn't have to be compiled --
    QCMDEXC and other alternatives allow execution of a command string that
    you can build.

    If you want it to be compiled, you can use duplicate values in the
    trailing list elements. I.e., the following is valid for three list
    elements:

    CHGVAR VAR(&TMPVAR) VALUE('CD')

    DSPJRN JRN(QAUDJRN) USRPRF(user) FROMTIME(05012005) +
    ENTTYP('CD' 'AF' &TMPVAR)

    In this way, three list elements are reserved in the command when its
    compiled. It doesn't matter that two of those elements supply 'CD'.

    When a different third element is needed, a different value can be
    provided for &TMPVAR. Although 'CD' gets supplied twice here, the result
    is that we have the _possibility_ of a variable number of entry types
    combined with a compiled command. If we need to use a 'DO' entry type
    later, we can simply put that value into &TMPVAR.

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

+ Reply to Thread