PRINT       PRINT FROM A CL PROGRAM                    TAACLPH

 The PRINT  command allows you to  print from CL.   You must  format the
 print line in your program.  The ACTION parameter supports 4 options:

    *OPN          This must  be the first  statement executed.   You may
                  specify  a title  and up  to 3  column headings.   The
                  date, time  and  page  number appear  on  every  page.
                  You   may  also   specify  the   USRDTA  and   SPLFNAM
                  parameters that will appear with the spooled file.

    *OP2          This  is the same  as *OPN, but the  file is specified
                  as HOLD(*YES).    The  file  is not  released  by  any
                  PRINT function.

    *PRT          This is the default for printing a detail line.

    *PAG          This causes  a new page to  occur with the  same title
                  and  column headings as on  *OPN.  *PAG  allows you to
                  force a new  page heading.   Normal print overflow  is
                  handled automatically.

    *CLO          This closes the file.   No other entries may  be made.

 A typical set of commands in a CL program would be:

        /* Print heading */
              PRINT      ACTION(*OPN) TITLE('Library list') +
                           COLHD1('Library      Text description') +
                           SPLFNAM(LIBLIST)
        /* Your processing loop
               .
               .
                         /* Print detail line
              PRINT      LINE(&LIB *CAT '   ' *CAT &TEXT)
               .
               '
       /* Close print file */
              PRINT      ACTION(*CLO)

 The report would print to the spooled file LIBLIST as:

 **********************************************************************
 *                                                                    *
 *      1/21/09     8:53:42             Library list       Page   1   *
 *                                                                    *
 *   Library      Text description                                    *
 *                                                                    *
 *   PAYROLL      The Payroll library                                 *
 *   DISTRIB      The Distribution library                            *
 *                                                                    *
 *                                                                    *
 *        Records printed-    2                                       *
 *                                                                    *
 **********************************************************************

 Note  that a  heading line  always appears  followed  by a  blank line.
 Each  column head  prints (if any)  followed by another  blank line (if
 any column headings print).   A total always appears at the  bottom for
 the number of *PRT actions executed.

 Note  that you must  concatenate in  enough blank  spaces to  meet your
 formatting  requirements.   Another alternative  is to build  the print
 line with the BLDPRTLIN TAA Tool.

 By default,  the printer  file used  is TAACLPHS  which  is created  as
 part of the  tool.  The printer  file is created using  the defaults of
 CRTPRTF.   You can use an  OVRPRTF command to TAACLPHS  in your program
 or name a file on the PRTFILE parameter.

 The purpose of  a unique  printer file  is to allow  other tools  which
 print to QPRINT to be  able to use the PRINT tool  without running into
 conflicts.

 Conditional  prompting  exists  so  the  command  prompt  as  it  first
 appears  uses  only  the LINE  and  ACTION  parameters.   Based  on the
 Action value, additional parameters may appear.

 PRINT2 Command
 --------------

 The  PRINT  tool  also  supports  the  PRINT2  command  which  is  used
 internally by  TAA Tools.   The purpose  of PRINT2 is  to allow  you to
 use  the PRINT  command  in conjunction  with a  TAA command  that also
 requires the PRINT function.

 You should not being using PRINT2 in your applications.

 Command parameters                                    *CMD
 ------------------

    LINE          The formatted print  line.   Up to  132 positions  may
                  be specified.   The default is  *NONE.  If a  value is
                  entered, you must specify ACTION(*PRT).

    ACTION        The  action to  be performed.    The default  is *PRT.
                  The following entries are supported:

         *OPN          This opens the  file and causes  the headings  to
                       print.   You  may specify  TITLE, COLHD1,  COLHD2
                       and  COLHD3, USRDTA and  SPLFNAM.  Once  the file
                       is  open, you may not  reopen it without doing an
                       ACTION(*CLO).

         *OP2          This is  the same  as *OPN, but  causes the  file
                       to be  HOLD(*YES).  The  file is not  released by
                       any   PRINT   function.     The   prompt  control
                       function of *OPN  does not  occur.   You may  use
                       F9   from  the   prompter  to   prompt  for   all
                       parameters  or use *OPN  and then  change to *OP2
                       after prompting occurs.

         *PRT          This is  the default  and  prints a  detail  line
                       with the  value of the  LINE parameter.   You may
                       specify  SPCBFR   and/or  SPCAFT  and  the  COUNT
                       parameter.    You  may  not  specify  the heading
                       information.

         *PAG          This causes a skip  to a new page and  prints the
                       same    headings   that    were   specified    on
                       ACTION(*OPN).      New   headings   may  not   be
                       specified.  *PAG allows you  to force a new  page
                       heading.    Normal  print   overflow  is  handled
                       automatically.

         *CLO          This  causes the  file to  be  closed.   No other
                       entries may be made.

    SPCBFR        Space  before.    The  default  is  0.    0-3  may  be
                  specified.   This  parameter  is only  considered  for
                  ACTION(*PRT).

    SPCAFT        Space  after.    The   default  is  1.    0-3  may  be
                  specified.    This  parameter is  only  considered for
                  ACTION(*PRT).

    COUNT         This is a  *YES/*NO value that determines  whether the
                  line  being printed  will be  considered in  the final
                  total  of records printed.  *YES  is the default.  *NO
                  should be used  when you  are printing a  comment.   A
                  final  total will  only be  printed if  PRTCOUNT(*YES)
                  is specified for ACTION(*OPN).

    PRTCOUNT      Whether   to  print   a  final   total  or   not  when
                  ACTION(*OPN) is used.   *YES is  the default to  print
                  a final  count of the  records that were  specified as
                  COUNT(*YES) for ACTION(*PRT).

                  *NO may be specified to bypass the final total.

    TITLE         The report  title which appears  on every page.   This
                  may  only be  specified on ACTION(*OPN).   The default
                  is  *NONE.   The  date,  time  and  page  number  will
                  always   appear.     Up  to   80  characters   may  be
                  specified.

    COLHD1        The  first  line  of  column  headings.    Up  to  132
                  characters may be  specified.   The default is  *NONE.
                  An entry may only be made for ACTION(*OPN).

    COLHD2        The  second  line  of  column headings.    Up  to  132
                  characters  may be specified.   The  default is *NONE.
                  An entry may only be made for ACTION(*OPN).

    COLHD3        The  third  line  of  column  headings.    Up  to  132
                  characters may  be specified.   The default  is *NONE.
                  An entry may only be made for ACTION(*OPN).

    USRDTA        The  user  data   field  that  will  appear  with  the
                  spooled  file output.   The default is  *NONE in which
                  case the  field will be  blank.  A  value can only  be
                  specified on ACTION(*OPN).

    SPLFNAM       The  spooled  file  name  that will  appear  with  the
                  spooled  output.   The default  is CMDPRINT.   A value
                  can only be specified on ACTION(*OPN)

    RPTDATE       The date  to  appear in  the  heading of  the  report.
                  The default  is *JOB meaning  the date of  the current
                  job.   *SYSTEM may  be specified to  cause the current
                  system date to be used.

    PRTFILE       The name  of  the  Printer file  that  will  be  used.
                  *STD  is  the   default  which  causes   the  TAACLPHS
                  printer  file  to  be used.    If  a  printer file  is
                  named, it must be on the library list.

 Restrictions
 ------------

 None.

 Prerequisites
 -------------

 The following TAA Tools must be on your system:

            SNDESCMSG      Send escape message

 Implementation
 --------------

 None, the tool is ready to use.

 Objects used by the tool
 ------------------------

    Object        Type       Attribute      Src member     Src file
    ------        -----      ---------      ----------     -----------

    PRINT         *CMD                      TAACLPH        QATTCMD
    PRINT2        *CMD                      TAACLPH2       QATTCMD
    TAACLPHC      *PGM          CLP         TAACLPHC       QATTCL
    TAACLPHC2     *PGM          CLP         TAACLPHC2      QATTCL
    TAACLPHR      *PGM          RPG         TAACLPHR       QATTRPG
    TAACLPHR2     *PGM          RPG         TAACLPHR2      QATTRPG
    TAACLPHS      *FILE         PRTF            No source
    TAACLPHT      *FILE         PRTF            No source

 Structure
 ---------

 PRINT
   TAACLPHC         CL Pgm
     TAACLPHR         RPG Pgm
       TAACLPHS         Print file

 PRINT2
   TAACLPHC2        CL Pgm
     TAACLPHR2        RPG Pgm
       TAACLPHT         Print file

Added to TAA Productivity Tools April 1, 1995


Home Page

Last modified on March 10, 2014 © 1995, 2014 - TAA Tools, Inc.