Dave Snyder asked:

>Is there any easy way to default the user id and address on the
>SNDNETSPLF command so that the sent file always goes to the same
>location and not force the user to type it in?

If the system is at V4R5 or later then the following program can be
used to add a default user id and address to the SNDNETSPLF command.
Before using it you should modify it to change the current defaults
of "TOUSRID((AAAAAAAA BBBBBBBB))" to the desired default value.

The actual SNDNETSPLF command is not modified by this program. The
program works by adding the TOUSRID parameter to the command if it
is not already specified for the command. When created and registered
as a change command exit program it should work for most uses of
SNDNETSPLF including those on WRKSPLF, WRKOUTQ, etc. I have only done
a very brief test of this program on one release. I think it will work
elsewhere but you should modify it and then test it.

This program is based on a similar program found in the archives at
http://archive.midrange.com/midrange-l/200107/msg02330.html

/******************************************************************/
/*                                                                */
/*  Program name:  SNDNETSPLF                                     */
/*                                                                */
/*  The purpose of this program is to provide a default for the   */
/*  TOUSRID parameter of the SNDNETSPLF command. The way it works */
/*  is by making a modified copy of the command string and        */
/*  telling the OS/400 Command Analyzer to process the modified   */
/*  copy instead of the original entered by the user.             */
/*                                                                */
/*  Use the following CL command to create the SNDNETSPLF program */
/*  in a library of your choice.                                  */
/*                                                                */
/*    CRTCLPGM PGM(your-library/SNDNETSPLF)                       */
/*             SRCFILE(your-library/SOURCE-FILE)                  */
/*                                                                */
/*  Use the following CL command to cause the SNDNETSPLF program  */
/*  to be called each time anyone uses the SNDNETSPLF CL command. */
/*                                                                */
/*    ADDEXITPGM EXITPNT(QIBM_QCA_CHG_COMMAND) FORMAT(CHGC0100)   */
/*               PGMNBR(*LOW) PGM(your-library/SNDNETSPLF)        */
/*               PGMDTA(*JOB 20 'SNDNETSPLFQSYS      ')           */
/*                                                                */
/******************************************************************/
             PGM        PARM(&EXITINFO &RPLCMD &RPLLEN)
             DCL        &EXITINFO *CHAR 4000
             DCL        &RPLCMD   *CHAR 3950
             DCL        &RPLLEN   *CHAR 4
             DCL        &ALWCHG  *CHAR 1 /* Change allowed ? */
             DCL        &OFFSET  *DEC (6 0) /* OFFSET TO COMMAND */
             DCL        &CMDLEN  *DEC (6 0) /* LENGTH OF COMMAND */
             DCL        VAR(&PL) TYPE(*DEC) LEN(3 0) VALUE(8) /* +
                          Length of parameter  */
             DCL        VAR(&PRM) TYPE(*CHAR) LEN(8) +
                          VALUE('TOUSRID(') /* Parameter      */
             DCL        VAR(&AL) TYPE(*DEC) LEN(3 0) VALUE(30) /* +
                          Length of parameter to be added */
             DCL        VAR(&ADDPARM) TYPE(*CHAR) LEN(30) VALUE(' +
                          TOUSRID((AAAAAAAA BBBBBBBB)) ') /* +
                          Parameter to add */
             DCL        &INDEX *DEC (6) 1 /* Index into command */

             CHGVAR     VAR(%BIN(&RPLLEN)) VALUE(0) /* Set return +
                          parameter to indicate the command has +
                          not been changed yet */

      /*  Extract values from the input parameter structure.     */
             CHGVAR     VAR(&ALWCHG) VALUE(%SST(&EXITINFO 49 1)) +
                          /* Get command is allowed to be +
                          changed indicator */
             CHGVAR     VAR(&OFFSET) VALUE(%BIN(&EXITINFO 53 4)) +
                          /* Get offset to command string */
             CHGVAR     VAR(&OFFSET) VALUE(&OFFSET + 1) /* Add +
                          1 because CL offset start at 1 +
                          instead of 0 */
             CHGVAR     VAR(&CMDLEN) VALUE(%BIN(&EXITINFO 57 4)) +
                          /* Get length of command string */
             IF         COND(&CMDLEN > 3930) THEN(RETURN) /* Exit +
                          if the command is too big to fit in +
                          the return variable */
             CHGVAR     VAR(&RPLCMD) VALUE(%SST(&EXITINFO &OFFSET +
                          &CMDLEN)) /* Copy input command to +
                          output parameter */

      /*  Search to see if the parameter already exists on the   */
      /*  command. If it does then we will not add another one.  */
 LOOP1:      IF         COND(((&INDEX + &PL) < &CMDLEN) *AND +
                          (%SST(&RPLCMD &INDEX &PL) = &PRM)) +
                          THEN(RETURN) /* The parameter was +
                          already specified - so we are done */
             CHGVAR     VAR(&INDEX) VALUE(&INDEX + 1) /* Move to +
                          next character */
             IF         COND((&INDEX + &PL) < &CMDLEN) THEN(GOTO +
                          CMDLBL(LOOP1)) /* If there is room go +
                          back and search some more */

             IF         COND(&ALWCHG = '1') THEN(DO) /* Can the +
                          command be changed */
               CHGVAR VAR(&INDEX) VALUE(&CMDLEN + 1) /* Set +
                          command index to the end of the command */
               CHGVAR VAR(%SST(&RPLCMD &INDEX &AL)) +
                          VALUE(&ADDPARM) /* Add parameter */
               CHGVAR VAR(%BIN(&RPLLEN)) VALUE(&INDEX + &AL) /* +
                          Set return parameter to the new +
                          command length */
             ENDDO      /* End of the command can be changed */
             ENDPGM


Ed Fishel,
edfishel@xxxxxxxxxx



As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.