Purpose:
There are many printers in live environment used for printing different documents. Whenever, there is a problem with the physical printer or a shop closure, rerouting the printer to different out queue becomes quite a task to be planned and is time consuming.
The purpose of this document is to provide the background for this entire utility development and the benefits of using this utility.
Existing Scenario:
Non availability of a physical printer is indeed a show stopper. If this happens, the impact is really considerable, as most of the printers are setup location wise. Non availability of printer results in
Delay in job processing as the printers needs to redirect to other location.
Rerouting printer is a time consuming activity.
Reverting the step 2 is reinventing the same wheel, is again time consuming.
Manual efforts are significant.
The advantages mentioned above can be resolved by the Out Queue Change utility.
Utility Description:
Dataarea
The utility will create a library SPLDVTLIB and create a data area to hold the out queue (From out queue) parameters to be changed. The name of the data area thus created will have the first five character of out queue that needs to be routed and last five characters are from the first characters of the out queue that will receive the spool file redirection.
Example: If the out queue name to be redirected is ‘FROMOUTQ’ and the out queue to receive the redirection is ‘TOOUTQ’ the data area name that will be created by the utility in library SPLDVTLIB becomes ‘FROMOTOOUT’.
The purpose of the data area is not only to hold the parameters of the out queue. The program logic of the utility also ensures that the same routing is not repeated for the out queue.
These data areas are of type *CHAR, and are of 40 characters in length.
The critical to the utility is this data area they help in
Retaining the details of the out queue to be redirected.
Preventing the redirection more than once for the same out queue.
These data areas are deleted once the redirection is reverted.
Writer
The changes to the out queue cannot be done if the writer is started. The writer needs to be ended for the out queue to be changed. Once the out queue is changed the writer is started again. And because the out queue is changed the writer will point to other out queue.
Parameters to be changed
The parameters changed for this utility is ‘Remote Print Queue’ and ‘IP Address’. The Remote print queue parameter is retained in the data area and changed to the out queue to be redirected to. The IP address is also retained in the data area and then changed to loop back, ‘127.0.01’. This ensures the spool file to be redirected is routed to the remote printer specified in the ‘Remote Print Queue’ parameter.
CL program:
The CL program that implements the utility is provided below.
PGM PARM(&FROMOUTQ &FOUTQLIB &TOOUTQ &TOUTQLIB)
DCL VAR(&FROMOUTQ) TYPE(*CHAR) LEN(10)
DCL VAR(&FOUTQLIB) TYPE(*CHAR) LEN(10)
DCL VAR(&TOOUTQ) TYPE(*CHAR) LEN(10)
DCL VAR(&TOUTQLIB) TYPE(*CHAR) LEN(10)
DCL VAR(&IPADR) TYPE(*CHAR) LEN(15)
DCL VAR(&DTAARANAM) TYPE(*CHAR) LEN(10) /* The +
data area to be created for holding out +
queue values */
DCL VAR(&DTAARAREV) TYPE(*CHAR) LEN(10) /* This +
data area is not reverse check */
DCL VAR(&RCVAR) TYPE(*CHAR) LEN(800)
DCL VAR(&RCVLEN) TYPE(*CHAR) LEN(4)
DCL VAR(&FRMPARA) TYPE(*CHAR) LEN(20) /* 'This +
is the calue passed tos API' */
DCL VAR(&FMTNAM) TYPE(*CHAR) LEN(8) +
VALUE('OUTQ0100')
DCL VAR(&RMTPRTQNAM) TYPE(*CHAR) LEN(15)
CHGJOB LOG(4 0 *SECLVL)
CHKOBJ OBJ(&FOUTQLIB/&FROMOUTQ) OBJTYPE(*OUTQ)
MONMSG MSGID(CPF9801) EXEC(DO)
SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA('Specify +
the correct out queue that needs to be +
diverted')
GOTO ENDPGM
ENDDO
CHKOBJ OBJ(&TOUTQLIB/&TOOUTQ) OBJTYPE(*OUTQ)
MONMSG MSGID(CPF9801) EXEC(DO)
SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA('Specify +
the correct out queue to which spools +
needs to get diverted.')
GOTO ENDPGM
ENDDO
/********* THE WRITER NEEDS TO BE ENDED TO GET DIVERTED TO OTHER QUEUE ********/
ENDWTR WTR(&FROMOUTQ) OPTION(*IMMED)
MONMSG MSGID(CPF3313)
/******************************************************************************/
CHGVAR VAR(%SST(&FRMPARA 1 10)) VALUE(&FROMOUTQ)
CHGVAR VAR(%SST(&FRMPARA 11 10)) VALUE(&FOUTQLIB)
CHGVAR VAR(%BIN(&RCVLEN)) VALUE(800)
/********** DATA AREA CREATION ********************/
CHGVAR VAR(%SST(&DTAARANAM 1 5)) VALUE(%SST(&FROMOUTQ 1 5))
CHGVAR VAR(%SST(&DTAARANAM 6 5)) VALUE(%SST(&TOOUTQ 1 5))
CHGVAR VAR(%SST(&DTAARAREV 1 5)) VALUE(%SST(&TOOUTQ 1 5))
CHGVAR VAR(%SST(&DTAARAREV 6 5)) VALUE(%SST(&FROMOUTQ 1 5))
/******************************************************************************/
CRTDTAARA: CRTDTAARA DTAARA(SPLDVTLIB/&DTAARANAM) TYPE(*CHAR) +
LEN(40) TEXT('Created for spool file +
printing redirection')
MONMSG MSGID(CPF1023) EXEC(GOTO CMDLBL(MSG1))
MONMSG MSGID(CPF1021) EXEC(DO)
CRTLIB LIB(SPLDVTLIB) TEXT('Library for spool file +
redirection utility')
GOTO CMDLBL(CRTDTAARA)
ENDDO
CRTDTAARA DTAARA(SPLDVTLIB/&DTAARAREV) TYPE(*CHAR) +
LEN(40) TEXT('Spool file redirection')
MONMSG MSGID(CPF1023) EXEC(GOTO CMDLBL(REVERT))
DLTDTAARA DTAARA(SPLDVTLIB/&DTAARAREV)
CALL PGM(QSPROUTQ) PARM(&RCVAR &RCVLEN &FMTNAM +
&FRMPARA X'00000000')
CHGVAR VAR(&RMTPRTQNAM) VALUE(%SST(&RCVAR 472 128))
CHGVAR VAR(&IPADR) VALUE(%SST(&RCVAR 218 15))
CHGDTAARA DTAARA(SPLDVTLIB/&DTAARANAM (1 15)) +
VALUE(&RMTPRTQNAM)
CHGDTAARA DTAARA(SPLDVTLIB/&DTAARANAM (16 15)) VALUE(&IPADR)
CHGOUTQ OUTQ(&FOUTQLIB/&FROMOUTQ) RMTSYS(*INTNETADR) +
RMTPRTQ(&TOOUTQ) INTNETADR('127.0.0.1')
STRRMTWTR OUTQ(&FOUTQLIB/&FROMOUTQ)
SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA('The +
spool divertion has been succesfully setup')
GOTO ENDPGM
REVERT: RTVDTAARA DTAARA(SPLDVTLIB/&DTAARAREV (16 15)) +
RTNVAR(&IPADR)
RTVDTAARA DTAARA(SPLDVTLIB/&DTAARAREV (1 15)) +
RTNVAR(&RMTPRTQNAM)
ENDWTR WTR(&FROMOUTQ) OPTION(*IMMED)
CHGOUTQ OUTQ(&TOUTQLIB/&TOOUTQ) RMTSYS(*INTNETADR) +
RMTPRTQ(&TOOUTQ) INTNETADR(&IPADR)
SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA('The +
spool file divertion reverted, Thank you!')
DLTDTAARA DTAARA(SPLDVTLIB/&DTAARANAM)
DLTDTAARA DTAARA(SPLDVTLIB/&DTAARAREV)
STRRMTWTR OUTQ(&FOUTQLIB/&FROMOUTQ)
GOTO CMDLBL(ENDPGM)
MSG1: SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA('The +
diversion is already active')
ENDPGM: ENDPGM
Benefits & drawbacks:
This utility will help in following benefits.
The redirecting and reverting can be done by calling the program and passing the parameters. Calling the same program will revert the redirection. Repeating the same step one more time, will enable the redirection the other way around.
This utility can help if the physical printer is not working.
Avoid any changes to the application for spool file redirection.
Saves lot of time and rework.
Drawbacks:
The utility is not user specific. Reach me for more utilities and any clarifications at dean@iseriesuniversity.com

0 Comments:
Post a Comment
<< Home