IBM Support

Solution to Printer Writers Not Starting at IPL

Troubleshooting


Problem

This document discusses a problem where writers are started automatically after an IPL, but the Start Print Writer (STRPRTWTR) command is failing with message CPA3387 - Device &4 not available, even through the printer is in VARIED ON status.

Resolving The Problem

This document discusses a problem where writers are started automatically after an IPL, but the Start Print Writer (STRPRTWTR) command is failing with message CPA3387 - Device &4 not available, even through the printer is in VARIED ON status. In fact, answering CPA3387 with an "R" (Retry) causes the writer to start successfully. The problem is that the writer is being started before the printer device description has achieved VARIED ON status; however, it does go to VARIED ON status after a few minutes, which is why answering message CPA3387 with an "R" causes the writer to start successfully.

This document was last updated on 30 October 2013.



Remote writers and printer writers for network printers are usually started automatically after an IPL, or after completing backups. If TCP/IP has not finished starting at the time that the writers are started and there are spooled files waiting to be printed, this can cause those spooled files to fail to print and can cause the writers to end abnormally.

In the case of a printer writer, the writer will most likely fail with as error message, such as message CPD338A - Cannot resolve to remote device name &1.

To diagnose this further. print the History Log for around the time of the failure using the Display Log (DSPLOG) command. For example:

DSPLOG PERIOD(('00:00:01' *CURRENT) (*AVAIL *CURRENT)) OUTPUT(*PRINT)

then display the resulting QPDSPLOG spooled file, looking for the following messages:

CPF3382: Writer &3/&2/&1 started.

CPF3397: Writer &3/&2/&1 did not end normally.

TCP8A3E: Interface 127.0.0.1 is active.

If the writers are starting and ending prior to the 127.0.0.1 (LOOPBACK) interface becoming active, then the QSPL subsystem is being started before TCP/IP has had a chance to fully initialize, causing the writers to fail to connect to the network printers. If this is the cause of the problem, then the QSTRUP program will need to be modified to add a delay of at least 5 or 10 minutes prior to starting the QSPL subsystem.



  • - Modifying the QSTRUP CL Source Code to Add Delay Before Calling the QWCSWTRS CL Program




    Another option that may help to get all of the printer writers to start successfully after an IPL would be to delay 5 or 10 minutes (or perhaps longer) prior to starting the QSPL subsystem and calling the QWCSWTRS CL program. This can be done by doing the following:

    1.By default, i5/OS will use the QSYS/QSTRUP program. However, customers can create their own startup program and can use a name other than "QSTRUP" or a library other than "QSYS".

    To determine the name and library for the "startup" program, run the following Display System Value (DSPSYSVAL) command to display the value for the QSTRUPPGM (Startup program) system value:

    DSPSYSVAL SYSVAL(QSTRUPPGM)
    2.Run the following Display Object Description (DSPOBJD) command to determine the source file and library, and source member, used to create your current startup program:

    DSPOBJD OBJ(library-name/program-name) OBJTYPE(*PGM) DETAIL(*SERVICE)


    If modified it will show the source file and member that should be changed:
    3a.If the DSPOBJD command from Step 2 shows something like the following:

      Source file  . . . . . . . . . . . . :   S000028739
        Library  . . . . . . . . . . . . . :     $BLDSS1
      Member . . . . . . . . . . . . . . . :   S000028739

    then retrieve the source of the shipped startup program into the QSTRUP member in the QGPL/QCLSRC source physical file using the RTVCLSRC command. For example:

    RTVCLSRC PGM(QSYS/QSTRUP) SRCFILE(QGPL/QCLSRC) SRCMBR(*PGM)

    and then edit the source member by either using the Work with Members Using PDM (WRKMBRPDM) command to work with the QGPL/QCLSRC source physical file. For example:

    WRKMBRPDM FILE(QGPL/QCLSRC)

    and taking Option 2 (Edit) on the QSTRUP source member, or by using the Start Source Entry Utility (STRSEU) command, For example:

    STRSEU SRCFILE(QGPL/QCLSRC) SRCMBR(QSTRUP)
    3b.If the DSPOBJD command from Step 2 shows something like the following:

    Source file  . . . . . . . . . . . . :   QCLSRC
      Library  . . . . . . . . . . . . . :     QGPL
    Member . . . . . . . . . . . . . . . :   QSTRUP

    then edit the source member that was used to create your current startup program by either using the Work with Members Using PDM (WRKMBRPDM) command to work with the source physical file shown. For example:

    WRKMBRPDM FILE(library-name/source-file-name)

    and taking Option 2 (Edit) on the source member shown, or by using the Start Source Entry Utility (STRSEU) command, For example:

    STRSEU SRCFILE(library-name/source-file-name) SRCMBR(member-name)
    4.Find the place in the QSTRUP source code where the QSPL subsystem and QWCSWTRS CL program is called, for example:

    DONE:
         QSYS/STRSBS SBSD(QSPL)
        MONMSG MSGID(CPF0000)
        QSYS/RTVSYSVAL SYSVAL(QSTRPRTWTR) RTNVAR(&STRWTRS)
        IF COND(&STRWTRS = '0') THEN(GOTO CMDLBL(NOWTRS))
        CALL PGM(QSYS/QWCSWTRS)
        MONMSG MSGID(CPF0000)
    NOWTRS:

         RETURN
        CHGVAR VAR(&CPYR) VALUE(&CPYR)
        ENDPGM
    5.Modify the QSTRUP source code to use the Delay Job (DLYJOB) command with the Job delay time (DLY) parameter set to 300 seconds (5 minutes) or 600 seconds (10 minutes), or some other value if desired, immediately prior to the "QSYS/STRSBS SBSD(QSPL)". For example:

    DONE:
         QSYS/DLYJOB DLY(600)  /* Delay 10 minutes before starting QSPL */
         QSYS/STRSBS SBSD(QSPL)
        MONMSG MSGID(CPF0000)
        QSYS/RTVSYSVAL SYSVAL(QSTRPRTWTR) RTNVAR(&STRWTRS)
        IF COND(&STRWTRS = '0') THEN(GOTO CMDLBL(NOWTRS))
        CALL PGM(QSYS/QWCSWTRS)
        MONMSG MSGID(CPF0000)
    NOWTRS:

         RETURN
        CHGVAR VAR(&CPYR) VALUE(&CPYR)
        ENDPGM
    6.Use the Create CL Program (CRTCLPGM) command to compile the CL program and create your user-modified startup program in a library other than QSYS. For example:

    CRTCLPGM PGM(QGPL/QSTRUP) SRCFILE(library-name/source-file-name)
             SRCMBR(member-name) TEXT('User-modified startup program')
    7.Use the Work with System Value (WRKSYSVAL) command, for example:

    WRKSYSVAL SYSVAL(QSTRUPPGM)

    and take Option 2 (Change) on the QSTRUPPGM (Startup program) system value to specify the program name and library that you created in Step 6
    The above description is appropriate for those using the startup program released with the system. If you already have a modified startup program you must alter the above as needed.




  • - Modifying the Operational Assistant Backup Exit Program to Start Writers after Backups



    The following document provides an example of a user-written program, also known as an exit program, that can be used to tailor your Operational Assistant backup:

    N1018472: Tailoring the Operational Assistant Backup Exit

    If you are currently using an exit program with GO BACKUP, but your writers are not starting automatically after backups, then your exit program should be changed to end the QSPL subsystem prior to performing backups and to restart the QSPL subsystem and call the QWCSWTRS CL program to start your printer writers after performing backups. For example:


    PGM   PARM(&PRODID &FLAG &OPTIONS &DEVS &TAPSET &RETCODE)
            DCL   VAR(&PRODID) TYPE(*CHAR) LEN(10)     /* Calling product. +
                     Will be 'QEZBACKUP' when called from Operational Assistant. */
            DCL   VAR(&FLAG) TYPE(*CHAR) LEN(10)       /* Indicates whether +
                                           before or after backup.     */
            DCL   VAR(&DEVS) TYPE(*CHAR) LEN(40)       /* Devices used.  */
            DCL   VAR(&TAPSET) TYPE(*CHAR) LEN(4)      /* Tape set name  */
            DCL   VAR(&RETCODE) TYPE(*CHAR) LEN(7)     /* Return code    */
            DCL   VAR(&OPTIONS) TYPE(*CHAR) LEN(10)    /* Options used   */
           

    IF    COND(&FLAG *EQ '*BEFORE    ') THEN(DO)
            /*--------------------------------------------------------*/
            /*  Insert commands to be run before the backup here.     */
            /*--------------------------------------------------------*/

            /*--------------------------------------------------------*/
            /*  End QSPL subsystem since network printers won't be    */
            /*  able to print while TCP/IP communications is down     */
            /*--------------------------------------------------------*/
            ENDSBS     SBS(QSPL) OPTION(*IMMED)
            MONMSG     MSGID(CPF0000)

            ENDDO

    IF    COND(&FLAG *EQ '*AFTER     ') THEN(DO)
            /*--------------------------------------------------------*/
            /*  Insert commands to be run after the backup here.      */
            /*--------------------------------------------------------*/

            /*--------------------------------------------------------*/
            /*  Restart the QSPL subsystem and call the QWCSWTRS CL   */
            /*  program to start printer writers after a 10 minute    */
            /*  delay, which should give TCP/IP communications        */
            /*  enough time to fully up-and-running before starting   */
            /*  printer writers for any network printers              */
            /*--------------------------------------------------------*/
            QSYS/DLYJOB DLY(600)
            QSYS/STRSBS SBSD(QSPL)
            MONMSG MSGID(CPF0000)
            CALL PGM(QSYS/QWCSWTRS)
            MONMSG MSGID(CPF0000)

            ENDDO
            ENDPGM


    This is particularly important if TCP/IP communications is halted while performing backups so the system will not attempt to print to network printers without TCP/IP communications.

    If TCP/IP is ended prior to performing backups and restarted after performing backups; however, the QSPL subsystem is not ended and restarted. You may not be able to successfully print across the network, for example:

    o*LAN IPDS printer device descriptions
    o*LAN 3812 printer device descriptions
    oRemote Output Queues (RMTOUTQs)
    oSend TCP/IP Spooled File (SNDTCPSPLF or LPR) command
    oPC5250 or TN5250e printer sessions




  • - Calling the QWCSWTRS CL Program to Start Printer Writers



    This problem can be resolved by changing the QSTRUP program to call the QWCSWTRS program, rather than using the Start Print Writer (STRPRTWTR) command with the Printer (DEV) parameter set to *ALL. This program attempts to start all the printer writers, but does so only after each printer device descriptions has achieved VARIED ON status.

    The QWCSWTRS program is available in R320 IBM OS/400 and above, and the QSTRUP program has already been modified in R360 OS/400 and above. Prior to R320 OS/400, the QWCSWTRS program is available through one of the following PTFs:

    R310SF24360 (5227)
    R305SF24323 (1000)
    R230SF24322 (1000)

    The system-supplied IPL Startup program, QSTRUP, at the latest releases is setup to call the QWCSWTRS program to start the printer writers. If the IPL Startup program is setup to do a "STRPRTWTR WTR(*ALL)", then it should be changed to call the QWCSWTRS program instead. For detailed information on modifying the QSTRUP source code, refer to one of the following Rochester Support Center knowledgebase documents:

    N1019476: Changing the IPL Start-Up Program - V5R3M0 and Above

    Note: If running V3R2M0 (R320) OS/400 or earlier, then refer to the section titled Modifying the QSTRUP CL Source Code (R320 Operating System and Below) below.




  • - Modifying the QWCSWTRS Program to Increase the Number of Loops (&MAXLOOP) or the Delay Between Loops (&DELAY)



    Retrieving the CL Source for the QWCSWTRS Program

    Usually the file QCLSRC in library QGPL is used for this purpose; however, you may use a different source file if you wish. If you wish to use a particular source file and it already has a QWCSWTRS member of type CLP then you might want to retrieve the source into a new member and compare it with the source in the existing QWCSWTRS member. The source file must exist prior to executing the retrieve command or the command will fail. The Create Source Physical File (CRTSRCPF) command can be used to create a new source file if needed, for example:

    CRTSRCPF FILE(library-name/QCLSRC)

    Press the Enter key.

    To retrieve the CL source for the QWCSWTRS writer start-up program, use the Retrieve CL Source (RTVCLSRC) command line, for example:

    RTVCLSRC  PGM(QSYS/QWCSWTRS)  SRCFILE(library-name/QCLSRC)

    Press the Enter key.

    Note that the PGM parameter as shown above assumes that you want to retrieve the CL source of the QWCSWTRS program from the QSYS library (the version that comes with the release of the system).


    Viewing and Modifying the QWCSWTRS Program Source

    The QWCSWTRS program source may be viewed and changed using the Application Development ToolSet/400 - SEU utilities that are installed as part of Licensed Program 5722PWS. To start the utility, use the STRPDM command. This gives you a menu of options for IBM OS/400 or IBM i5/OS Programming Development Manager (PDM). Type 3 on the command line (Work with members), and press the Enter key. You are shown a screen, Specify Members to work with. Type the name of the source file to be used, the name of the library the file resides in, and use *ALL for the Member Name and Type. Press the Enter key to display the list of members. The QCLSRC source file in QGPL is already on your system. Therefore, if you do not have a particular source file you want to use, you may use QCLSRC.

    If there is no QWCSWTRS program listed of type CLP, retrieve the source for QWCSWTRS using the RTVCLSRC command as shown above. If the RTVCLSRC command is used to retrieve a source of a program after you already have a list of members displayed from a source file, press the F5 key to refresh the list so the new member is listed with the other previous members.

    If your member list shows more than one QWCSWTRSxx member and you are not sure just which source member reflects the start-up program in use on your system, retrieve the member into a member with a different spelling for the name and compare it with your existing members.

    To view a particular member, type 5 as the OPT for that member, and press the Enter key. This causes the member to be displayed. To edit/change a particular member, type 2 as the OPT for that member, and press the Enter key. The source of the member is displayed.

    The following shows the code portion of the QWCSWTRS program as shown when editing on a display session or green screen (with the sequence numbers). This version of the program is what was released with iSeries V5R3M0, V5R4M0, and V6R1M0.

    0001.00 /********************************************************************/
    0002.00 /*                                                                  */
    0003.00 /* 5761SS1 V6R1M0 080215     RTVCLSRC Output     10/20/09 15:23:35  */
    0004.00 /*                                                                  */
    0005.00 /* Program name . . . . . . . . . . . . . . :   QWCSWTRS          PN*/
    0006.00 /* Library name . . . . . . . . . . . . . . :   QSYS              PL*/
    0007.00 /* Original source file . . . . . . . . . . :   S000018896        SN*/
    0008.00 /* Library name . . . . . . . . . . . . . . :   $BLDSS1           SL*/
    0009.00 /* Original source member . . . . . . . . . :   S000018896        SM*/
    0010.00 /* Source file change                                               */
    0011.00 /*   date/time  . . . . . . . . . . . . . . :   09/30/07 13:35:15 SC*/
    0012.00 /* Patch option . . . . . . . . . . . . . . :   *NOPATCH          PO*/
    0013.00 /* User profile . . . . . . . . . . . . . . :   *USER             UP*/
    0014.00 /* Text . . . :                                                   TX*/
    0015.00 /* Owner  . . . . . . . . . . . . . . . . . :   QSYS              OW*/
    0016.00 /* User mod flag  . . . . . . . . . . . . . :   *NO               UM*/
    0017.00 /* Retrieve include source  . . . . . . . . :   *NO               RI*/
    0018.00 /*                                                                ED*/
    0019.00 /********************************************************************/
    0020.00      PGM
    0021.00      DCL VAR(&CPYR) TYPE(*CHAR) LEN(90) VALUE('5761-SS1 (C) COPYRIGHT-
    0022.00   IBM COPR 1980,2007. LICENSED MATERIAL - PROGRAM PROPERTY OF IBM')
    0023.00      DCL VAR(&CFGSTS) TYPE(*CHAR) LEN(12)
    0024.00      DCL VAR(&CFGSTSLN) TYPE(*CHAR) LEN(4)
    0025.00      DCL VAR(&CONFTYPE) TYPE(*CHAR) LEN(10) VALUE('*DEVD     ')
    0026.00      DCL VAR(&COUNT) TYPE(*DEC) LEN(5 0)
    0027.00      DCL VAR(&COUNTFP) TYPE(*DEC) LEN(5 0)
    0028.00      DCL VAR(&COUNTVOP) TYPE(*DEC) LEN(4 0)
    0029.00      DCL VAR(&COUNTWTS) TYPE(*DEC) LEN(4 0)
    0030.00      DCL VAR(&DELAY) TYPE(*DEC) LEN(4 0)
    0031.00      DCL VAR(&DEVNAME) TYPE(*CHAR) LEN(10)
    0032.00      DCL VAR(&DEVSTS) TYPE(*CHAR) LEN(4)
    0033.00      DCL VAR(&ERROR) TYPE(*CHAR) LEN(1) VALUE('N')
    0034.00      DCL VAR(&ERRCODE) TYPE(*CHAR) LEN(8) VALUE(X'0000000000000000')
    0035.00      DCL VAR(&FORMAT) TYPE(*CHAR) LEN(8) VALUE('CFGD0100')
    0036.00      DCL VAR(&FORMAT2) TYPE(*CHAR) LEN(8) VALUE('CFGS0100')
    0037.00      DCL VAR(&GENHDR) TYPE(*CHAR) LEN(1000)
    0038.00      DCL VAR(&INITIAL) TYPE(*CHAR) LEN(1) VALUE('Y')
    0039.00      DCL VAR(&MAXLOOP) TYPE(*DEC) LEN(4 0)
    0040.00      DCL VAR(&MAXPPL) TYPE(*DEC) LEN(4 0)
    0041.00      DCL VAR(&MSGDTA) TYPE(*CHAR) LEN(8) VALUE(X'0000000000000000')
    0042.00      DCL VAR(&NUMENT) TYPE(*DEC) LEN(4 0)
    0043.00      DCL VAR(&NUMENTB) TYPE(*CHAR) LEN(4)
    0044.00      DCL VAR(&NUMLTP) TYPE(*DEC) LEN(4 0)
    0045.00      DCL VAR(&OBJQUAL) TYPE(*CHAR) LEN(40) VALUE('*PRT               -
    0046.00                      ')
    0047.00      DCL VAR(&OFFSETDA) TYPE(*DEC) LEN(5 0)
    0048.00      DCL VAR(&OFFSETDB) TYPE(*DEC) LEN(5 0)
    0049.00      DCL VAR(&OFFSETDC) TYPE(*DEC) LEN(5 0)
    0050.00      DCL VAR(&OFFSETDD) TYPE(*DEC) LEN(5 0)
    0051.00      DCL VAR(&OFFSETUS) TYPE(*CHAR) LEN(4)
    0052.00      DCL VAR(&OFFSETUSB) TYPE(*DEC) LEN(6 0)
    0053.00      DCL VAR(&ENTRYLEN) TYPE(*CHAR) LEN(4)
    0054.00      DCL VAR(&ENTRYLEND) TYPE(*DEC) LEN(5 0)
    0055.00      DCL VAR(&RC0100) TYPE(*CHAR) LEN(110)
    0056.00      DCL VAR(&RECVAR0100) TYPE(*CHAR) LEN(3200)
    0057.00      DCL VAR(&STSQUAL) TYPE(*CHAR) LEN(20) VALUE('                   -
    0058.00  ')
    0059.00      DCL VAR(&STS30) TYPE(*CHAR) LEN(4)
    0060.00      DCL VAR(&STS75) TYPE(*CHAR) LEN(4)
    0061.00      DCL VAR(&STS100) TYPE(*CHAR) LEN(4)
    0062.00      DCL VAR(&SUMPRTRS) TYPE(*DEC) LEN(5 0)
    0063.00      DCL VAR(&USRSPC) TYPE(*CHAR) LEN(20) VALUE('XSTRPRTWTRQTEMP     -
    0064.00 ')
    0065.00      DCL VAR(&USPCBLEN) TYPE(*CHAR) LEN(4)
    0066.00      DCL VAR(&USPCBLENB) TYPE(*DEC) LEN(4 0)
    0067.00      CHGVAR VAR(%BIN(&OFFSETUS)) VALUE(1)
    0068.00      CHGVAR VAR(%BIN(&CFGSTSLN)) VALUE(12)
    0069.00      CHGVAR VAR(%BIN(&STS30)) VALUE(30)
    0070.00      CHGVAR VAR(%BIN(&STS75)) VALUE(75)
    0071.00      CHGVAR VAR(%BIN(&STS100)) VALUE(100)
    0072.00      CHGVAR VAR(&COUNTVOP) VALUE(0)
    0073.00      CHGVAR VAR(&COUNTFP) VALUE(0)
    0074.00      CHGVAR VAR(&COUNTWTS) VALUE(0)
    0075.00      CHGVAR VAR(&DELAY) VALUE(5)
    0076.00      CHGVAR VAR(&MAXLOOP) VALUE(20)
    0077.00      CHGVAR VAR(&MAXPPL) VALUE(100)
    0078.00      CHGVAR VAR(&SUMPRTRS) VALUE(0)
    0079.00      CALL PGM(QSYS/QUSCRTUS) PARM('XSTRPRTWTRQTEMP     ' ' ' -
    0080.00 X'00040000' ' ' '*ALL      ' ' ' '*YES      ' &ERRCODE)
    0081.00 PROCED1: +
    0082.00      CALL PGM(QSYS/QDCLCFGD) PARM(&USRSPC &FORMAT &CONFTYPE &OBJQUAL -
    0083.00 &STSQUAL &ERRCODE)
    0084.00      MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(ABORT))
    0085.00      CALL PGM(QSYS/QUSRTVUS) PARM('XSTRPRTWTRQTEMP     ' X'00000001' -
    0086.00 X'0000008C' &GENHDR &ERRCODE)
    0087.00      CHGVAR VAR(&NUMENTB) VALUE(%SST(&GENHDR 133 4))
    0088.00      CHGVAR VAR(&NUMENT) VALUE(%BIN(&NUMENTB))
    0089.00      CHGVAR VAR(&ENTRYLEN) VALUE(%SST(&GENHDR 137 4))
    0090.00      CHGVAR VAR(&ENTRYLEND) VALUE(%BIN(&ENTRYLEN))
    0091.00      CHGVAR VAR(&USPCBLENB) VALUE(&ENTRYLEND * &MAXPPL)
    0092.00      CHGVAR VAR(%BIN(&USPCBLEN)) VALUE(&USPCBLENB)
    0093.00      IF COND(&NUMENT *EQ 0) THEN(DO)
    0094.00      GOTO CMDLBL(ABORT)
    0095.00      ENDDO
    0096.00 LOOP1:
    0097.00      CHGVAR VAR(&NUMLTP) VALUE(&NUMENT)
    0098.00      CHGVAR VAR(&OFFSETUS) VALUE(%SST(&GENHDR 125 4))
    0099.00      CHGVAR VAR(&OFFSETUSB) VALUE(%BIN(&OFFSETUS) + 1)
    0100.00      CHGVAR VAR(%BIN(&OFFSETUS)) VALUE(&OFFSETUSB)
    0101.00 LOOP2:
    0102.00      IF COND(&NUMLTP *LE &MAXPPL) THEN(DO)
    0103.00      CHGVAR VAR(&COUNT) VALUE(&NUMLTP)
    0104.00      ENDDO
    0105.00      ELSE CMD(DO)
    0106.00      CHGVAR VAR(&COUNT) VALUE(&MAXPPL)
    0107.00      ENDDO
    0108.00      CHGVAR VAR(&NUMLTP) VALUE(&NUMLTP - &COUNT)
    0109.00      CHGVAR VAR(&OFFSETDA) VALUE(1 - &ENTRYLEND)
    0110.00      CALL PGM(QSYS/QUSRTVUS) PARM('XSTRPRTWTRQTEMP     ' &OFFSETUS -
    0111.00 &USPCBLEN &RECVAR0100 &ERRCODE)
    0112.00 LOOP3:
    0113.00      CHGVAR VAR(&OFFSETDA) VALUE(&OFFSETDA + &ENTRYLEND)
    0114.00      CHGVAR VAR(&DEVNAME) VALUE(%SST(&RECVAR0100 &OFFSETDA 10))
    0115.00      CHGVAR VAR(&OFFSETDB) VALUE(&OFFSETDA + 10)
    0116.00      CHGVAR VAR(&OFFSETDC) VALUE(&OFFSETDB + 4)
    0117.00      CHGVAR VAR(&OFFSETDD) VALUE(&OFFSETDC + 4)
    0118.00      IF COND(&INITIAL *EQ 'Y') THEN(DO)
    0119.00      CHGVAR VAR(%SST(&RECVAR0100 &OFFSETDB 10)) VALUE('        5 ')
    0120.00      CALL PGM(QSYS/QDCRDEVD) PARM(&RC0100 X'0000006E' 'DEVD0100' -
    0121.00 &DEVNAME &ERRCODE)
    0122.00      MONMSG MSGID(CPF2702 CPF2625) EXEC(GOTO CMDLBL(PROCED2))
    0123.00      GOTO CMDLBL(PROCED3)
    0124.00 PROCED2:
    0125.00      CHGVAR VAR(%SST(&RECVAR0100 &OFFSETDB 10)) VALUE('NO ')
    0126.00 PROCED3:
    0127.00      CHGVAR VAR(%SST(&RECVAR0100 &OFFSETDB 4)) VALUE(%SST(&RC0100 42 -
    0128.00 4))
    0129.00      IF COND(%SST(&RECVAR0100 &OFFSETDB 4) *EQ '*YES') THEN(DO)
    0130.00      CHGVAR VAR(%SST(&RECVAR0100 &OFFSETDD 1)) VALUE(' ')
    0131.00      CHGVAR VAR(&COUNTWTS) VALUE(&COUNTWTS + 1)
    0132.00      ENDDO
    0133.00      ENDDO
    0134.00      IF COND(%SST(&RECVAR0100 &OFFSETDD 1) *EQ ' ') THEN(DO)
    0135.00      CALL PGM(QSYS/QDCRCFGS) PARM(&CFGSTS &CFGSTSLN &FORMAT2 -
    0136.00 &CONFTYPE &DEVNAME &ERRCODE)
    0137.00      MONMSG MSGID(CPF2702 CPF2625) EXEC(CHGVAR VAR(&ERROR) VALUE('Y'))
    0138.00      CHGVAR VAR(&DEVSTS) VALUE(%SST(&CFGSTS 9 4))
    0139.00      CHGVAR VAR(%SST(&RECVAR0100 &OFFSETDC 4)) VALUE(&DEVSTS)
    0140.00      IF COND(&DEVSTS *EQ &STS30) THEN(DO)
    0141.00      QSYS/STRPRTWTR DEV(&DEVNAME)
    0142.00      MONMSG MSGID(CPF0000)
    0143.00      CHGVAR VAR(%SST(&RECVAR0100 &OFFSETDD 1)) VALUE('1')
    0144.00      CHGVAR VAR(&COUNTVOP) VALUE(&COUNTVOP + 1)
    0145.00      CHGVAR VAR(&SUMPRTRS) VALUE(&SUMPRTRS + 1)
    0146.00      ENDDO
    0147.00      IF COND(&DEVSTS *EQ &STS100) THEN(DO)
    0148.00      CHGVAR VAR(&COUNTFP) VALUE(&COUNTFP + 1)
    0149.00      CHGVAR VAR(%SST(&RECVAR0100 &OFFSETDD 1)) VALUE('2')
    0150.00      CHGVAR VAR(&SUMPRTRS) VALUE(&SUMPRTRS + 1)
    0151.00      ENDDO
    0152.00      IF COND(&DEVSTS *EQ &STS75) THEN(DO)
    0153.00      CHGVAR VAR(%SST(&RECVAR0100 &OFFSETDD 1)) VALUE('3')
    0154.00      CHGVAR VAR(&COUNTFP) VALUE(&COUNTFP + 1)
    0155.00      CHGVAR VAR(&SUMPRTRS) VALUE(&SUMPRTRS + 1)
    0156.00      ENDDO
    0157.00      IF COND(&ERROR *EQ 'Y') THEN(DO)
    0158.00      CHGVAR VAR(&ERROR) VALUE('N')
    0159.00      CHGVAR VAR(%SST(&RECVAR0100 &OFFSETDD 1)) VALUE('F')
    0160.00      CHGVAR VAR(&COUNTFP) VALUE(&COUNTFP + 1)
    0161.00      CHGVAR VAR(&SUMPRTRS) VALUE(&SUMPRTRS + 1)
    0162.00      ENDDO
    0163.00      IF COND(&MAXLOOP *EQ 1) THEN(DO)
    0164.00      IF COND(%SST(&RECVAR0100 &OFFSETDD 1) *NE '1') THEN(DO)
    0165.00      CHGVAR VAR(&COUNTFP) VALUE(&COUNTFP + 1)
    0166.00      CHGVAR VAR(&SUMPRTRS) VALUE(&SUMPRTRS + 1)
    0167.00      ENDDO
    0168.00      ENDDO
    0169.00      ENDDO
    0170.00      IF COND(&INITIAL *NE 'Y') THEN(DO)
    0171.00      IF COND(&SUMPRTRS *EQ &COUNTWTS) THEN(GOTO CMDLBL(ALLDONE))
    0172.00      ENDDO
    0173.00      CHGVAR VAR(&COUNT) VALUE(&COUNT - 1)
    0174.00      IF COND(&COUNT *NE 0) THEN(GOTO CMDLBL(LOOP3))
    0175.00      CALL PGM(QSYS/QUSCHGUS) PARM('XSTRPRTWTRQTEMP     ' &OFFSETUS -
    0176.00 &USPCBLEN &RECVAR0100 '0' &ERRCODE)
    0177.00      IF COND(&NUMLTP *NE 0) THEN(DO)
    0178.00      CHGVAR VAR(&OFFSETUSB) VALUE(&OFFSETUSB + &USPCBLENB)
    0179.00      CHGVAR VAR(%BIN(&OFFSETUS)) VALUE(&OFFSETUSB)
    0180.00      GOTO CMDLBL(LOOP2)
    0181.00      ENDDO
    0182.00      IF COND(&NUMLTP *EQ 0) THEN(DO)
    0183.00      CHGVAR VAR(&MAXLOOP) VALUE(&MAXLOOP - 1)
    0184.00      IF COND(&MAXLOOP *NE 0) THEN(DO)
    0185.00      QSYS/DLYJOB DLY(&DELAY)
    0186.00      CHGVAR VAR(&INITIAL) VALUE('N')
    0187.00      GOTO CMDLBL(LOOP1)
    0188.00      ENDDO
    0189.00      ENDDO
    0190.00 ALLDONE:
    0191.00      CHGVAR VAR(%BIN(&MSGDTA 1 4)) VALUE(&COUNTVOP)
    0192.00      CHGVAR VAR(%BIN(&MSGDTA 5 4)) VALUE(&COUNTFP)
    0193.00      QSYS/SNDPGMMSG MSGID(CPC3301) MSGF(QCPFMSG) MSGDTA(&MSGDTA) -
    0194.00 TOMSGQ(*SYSOPR)
    0195.00 ABORT:
    0196.00      DLTUSRSPC USRSPC(QGPL/XSTRPRTWTR)
    0197.00      MONMSG MSGID(CPF2105) EXEC(GOTO CMDLBL(NOEXIST))
    0198.00      MONMSG MSGID(CPF0000)
    0199.00      GOTO CMDLBL(SPACEDLTD)
    0200.00 NOEXIST:
    0201.00      RCVMSG PGMQ(*SAME) MSGTYPE(*EXCP) RMV(*YES)
    0202.00 SPACEDLTD:
    0203.00      DLTUSRSPC USRSPC(QTEMP/XSTRPRTWTR)
    0204.00      MONMSG MSGID(CPF0000)
    0205.00      CHGVAR VAR(&CPYR) VALUE(&CPYR)
    0206.00      ENDPGM


    The system-supplied QWCSWTRS program will make a maximum of 20 passes of checking the printers for their vary on state, and will delay 5 seconds between each pass. You increase the delay between passes by changing the value specified for the &DELAY variable in the CHGVAR CL command, and you can increase the number of passes by changing the value specified for the &MAXLOOP variable in the CHGVAR CL command. For example:

    0075.00 CHGVAR VAR(&DELAY) VALUE(30)
    0076.00 CHGVAR VAR(&MAXLOOP) VALUE(25)


    Creating a Modified Version of the QWCSWTRS CL Program

    The system-supplied QWCSWTRS program can be renamed to XWCSWTRS so that it can be renamed back if any problems are found with the modified QWCSWTRS source code, for example:

    RNMOBJ OBJ(QSYS/QWCSWTRS) OBJTYPE(*PGM) NEWOBJ(XWCSWTRS)

    Then a modified version of QWCSWTRS program can be created using the Create CL Program (CRTCLPGM) command, for example:

    CRTCLPGM PGM(QSYS/QWCSWTRS) SRCFILE(QGPL/QCLSRC) SRCMBR(*PGM)
             TEXT(*SRCMBRTXT)

    Note: If needed the system-supplied QWCSWTRS program can be put back in place by deleting the modified version and renaming the XWCSWTRS program back to QWCSWTRS, for example:

    DLTPGM PGM(QSYS/QWCSWTRS)

    RNMOBJ OBJ(QSYS/XWCSWTRS) OBJTYPE(*PGM) NEWOBJ(QWCSWTRS)




  • - Modifying the QSTRUP CL Source Code (R320 Operating System and Below)



    To use the QWCSWTRS program, change your current system startup program as follows:

    1.Retrieve the source of the shipped startup program using the RTVCLSRC command. For example, on the operating system command line type the following:

    RTVCLSRC PGM(QSYS/QSTRUP) SRCFILE(library-name/QCLSRC)

    Press the Enter key.
    2.Modify the source for the QSTRUP program by moving the following five lines down to immediately following the DONE label:

    QSYS/RTVSYSVAL SYSVAL(QSTRPRTWTR) RTNVAR(&STRWTRS)
        IF COND(&STRWTRS = '0') THEN(GOTO CMDLBL(NOWTRS))
        QSYS/STRPRTWTR DEV(*ALL)
        MONMSG MSGID(CPF0000)
    NOWTRS:
    3.Change the third line above from "QSYS/STRPRTWTR DEV(*ALL)" to "CALL PGM(QSYS/QWCSWTRS)". The lines should now be:

    QSYS/RTVSYSVAL SYSVAL(QSTRPRTWTR) RTNVAR(&STRWTRS)
        IF COND(&STRWTRS = '0') THEN(GOTO CMDLBL(NOWTRS))
        CALL PGM(QSYS/QWCSWTRS)
        MONMSG MSGID(CPF0000)
    NOWTRS:
    4.Re-create the startup program using the CRTCLPGM command, putting it into your own library.
    5.Change the QSTRUPPGM (Startup program) system value to change the program name and library you specified on the CRTCLPGM command.
    The above description is appropriate for those using the startup program released with the system. If you already have a modified startup program you must alter the above as needed.

[{"Type":"MASTER","Line of Business":{"code":"LOB57","label":"Power"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SWG60","label":"IBM i"},"Platform":[{"code":"PF012","label":"IBM i"}],"Version":"7.1.0"}]

Historical Number

8064431

Document Information

Modified date:
18 December 2019

UID

nas8N1010213