z/OS TSO/E Programming Services
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Example 2: The Print Function CLIST

z/OS TSO/E Programming Services
SA32-0973-00

The application in Figure 1 expands upon the example in Figure 1. It performs the same printer selection function but also invokes either ICQCPC10 or ICQCPC15 to give the data set a SYSOUT CLASS of A and send it to the HOLD queue before printing it. The SYSOUT CLASS and HOLD keyword override anything else specified in the print definition. The application displays any messages set by the printer selection and print CLISTs.

Figure 1. The Print Function CLIST

/*********************************************************************/
/* THIS CLIST PROMPTS THE USER TO NAME A DATA SET TO BE PRINTED      */
/* AND A PRINTER LOCATION AND FORMAT.  THIS CLIST INVOKES ICQCPC00   */
/* TO ALLOW THE USER TO SELECT A PRINTER FROM A LIST OF PRINTERS.    */
/* THIS CLIST THEN INVOKES EITHER PRINT CLIST ICQCPC10 or ICQCPC15   */
/* TO EFFECT PRINTING ON THE SELECTED PRINTER.                       */
/*********************************************************************/
PROC 0
/*
CONTROL NOPROMPT NOFLUSH NOMSG END(ENDO)
/*
CONTROL CAPS
WRITENR DATA SET TO BE PRINTED  ===>
READ
SET &PRINTDSN = &SYSDVAL              /* check if fully qualified; if
                                      /* data set is not fully qualified,
IF &SUBSTR;(1:1,&PRINTDSN); ¬= &STR(') THEN + 
 SET &PRINTDSN = &STR;('&SYSPREF..&PRINTDSN'')  /* add prefix */
ELSE + 
 SET &PRINTDSN = &STR('&PRINTDSN'')              /* add quotes */
WRITE PRINTER LOCATION OR * FOR LIST (IF LOCATION CONTAINS A BLANK
WRITENR SURROUND IT WITH PARENTHESES) ===>
READ &QMPRTLOC
WRITENR PRINT FORMAT OR * FOR LIST ===>
READ &QMPRTFRM
WRITENR NUMBER OF COPIES ===>
READ &QMPRTNO
/*
CONTROL ASIS
IF &NRSTR(&QMPRTLOC) =  THEN + 
 SET QMPRTLOC = &STR(*)             /* If location is null, set to *
IF &NRSTR(&QMPRTFRM) =  THEN + 
 SET QMPRTFRM = &STR(*)             /* If format is null, set to *
 SET VERIFY = &STR(VERIFY)          /* verify only if named printer
 SET TEMP = &SYSINDEX(&STR(*),&QMPRTLOC,0)
 IF &TEMP ¬= 0 THEN + 
  SET VERIFY =                /* list (not verify) when unnamed printer
 SET TEMP = &SYSINDEX(&STR(*),&QMPRTFRM,0) /* check for an asterisk
 IF &TEMP ¬= 0 THEN + 
  SET VERIFY =                /* list (not verify) when unnamed printer
/**********************************************************************/
/* Display printer or list of printers                                */
/**********************************************************************/
    %ICQCPC00 PLOC('(&NRSTR(&QMPRTLOC))') + 
              PFORM('(&QMPRTFRM)') &VERIFY
    SET RC = &LASTCC
    IF &RC ¬= 0 THEN + 
     DO                               /* error selecting a printer
      ISPEXEC VGET (QCPMSGID) SHARED  /* get message identifier
      ISPEXEC SETMSG MSG(&QCPMSGID)   /* display message on next screen
     ENDO                             /* error selecting a printer
    ELSE + 
     DO                               /* user has selected a printer
/*********************************************************************/
/* Using the printer data selected by the user, invoke either        */
/* print routine ICQCPC10 or ICQCPC15.  If the user requests that    */
/* PRINTDS be used, ICQCPC15 is invoked.  Otherwise, ICQCPC10 is     */
/* invoked.  In either case, specify SYSOUT CLASS A and HOLD.        */
/*********************************************************************/
      VGET (QAPINFUN) SHARED          /* Obtain print function type
      IF &QAPINFUN = Y THEN + 
        %ICQCPC15 DSNAME(&NRSTR(&PRINTDSN)) SYSOUT(A) HOLD /* PRINTDS
      ELSE + 
        %ICQCPC10 DSNAME(&NRSTR(&PRINTDSN)) SYSOUT(A) HOLD /*Not PRINTDS
      SET RC = &LASTCC
      IF &RC ¬= 0 THEN + 
       DO                                /* error printing data set
        ISPEXEC VGET (QCPMSGID) SHARED   /* get message identifier
        ISPEXEC SETMSG MSG(&QCPMSGID)    /* display message
       ENDO                              /* error printing data set
     ENDO
 EXIT CODE(&RC)

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014