The TPRINT Statement

The TPRINT Statement 1

Statement Format 1

Statement OPTIONS.. 1

DATA.. 1

Data Item Options. 1

PIC.. 1

MID, COL, RCOL. 1

REPORT(nbr) 1

FOOT. 1

 

TPRINT is like a PRINT statement, but without implied column headings.  It is used within a Report Routine to define print lines to be printed at the beginning of every page.  A Report Routine is created from Easytrieve conversion when you convert a Report, and select [No] in answer to dialog. 

 

The EZT TITLE statements become Jazz TPRINT statements. TPRINT is only valid within such routines, and it is not valid within a program that uses PROGRAM xxx REPORT;   

Statement Format

TPRINT DATA(data list) [REPORT(nbr)] [FOOT]; 

The first item of the data list defines the line for this title, and must be a number from 1 to (PAGESIZE nbr of lines required by PRINT statements). PAGESIZE may be specified by a REPORT statement.  The default value is 60 if there is no REPORT statement.

Statement OPTIONS

DATA

DATA is the most important option of the TPRINT statement as it defines which fields are to be printed.  You will normally omit the keyword DATA, writing

            TPRINT (Nbr1, Item1, Item2, item3);

rather than writing

            TPRINT Nbr1 DATA(Item1, Item2, item3);

 

If DATA is written explicitly, then it does not have to be the first option of the TPRINT statement.

 

The data list consists of one or several items separated by commas. Items may be

·         Title Number. Required as the first item.

·         Field references, e.g. Customer.Name

·         String constants, e.g. 'xxxx'.

·         Numbers and decimal numbers

Data Item Options

Items can have options: -

·         PIC 'picture'

·         MID | COL | RCOL

PIC

You can specify an explicit layout for data if you do not want to use the defaults provided by Jazz.  For example,

Customer.Balance PIC '$,$$$,$$9.99 CR'

 

The PIC values follow the rules defined for defining data.  Click here for these rules, and look at PIC and DPIC in particular.

 

For numeric fields the value that you provide should be a valid COBOL PICTURE clause, and should be appropriate for the data.  Jazz provides only limited checking: whereas the default pictures will accommodate the maximum values that the field can hold and won’t put an alphabetic picture with numeric data or vice versa, Jazz does not check for these possible errors with explicit PIC clauses.

 

Formatting of DATE, BOOLEAN, and Coded fields is not implemented yet, so you will need to format the fields into a suitable CHAR field and refer to this.

For DATE fields the PIC value should define a date format, e.g.

Customer.Commenced PIC 'dd MMM yyyy'

 

BOOLEAN fields and fields with CODES will print as their value, for example

DEPTMGR BOOLEAN,

This defines a single-character field with value 'Y' or something else, but its value will be printed as 'True' or 'False'.   Similarly

SEX CHAR(1) CAPS CODES(M:Male, F:Female),

will print as 'Male' or 'Female'

MID, COL, RCOL

Use these to specify the starting (leftmost) or finishing (rightmost) column of the data item. MID may be given only once, and specifies that the item is placed in the middle of the line.  The item must not be numeric.  COL specifies the starting position of the item, and should be used for non-numeric items.  RCOL specifies the rightmost character of the item, and is used for numeric items. In the absence of any MID, COL, or RCOL option, the item is places in the next available position.

Items may not overlap, and the list of items must fit within the line width.  

REPORT(nbr)

Because you will have written the TPRINT statement within a Report Routine, this will be added for you.  All the TPRINT statements within a routine will have the same REPORT value.

FOOT

Specifies that this TPRINT will also be printed as a footer.   This option is only valid for the TPRINT for line 1. 

The following TPRINT statement is equivalent to the default title that will be printed at the top and bottom of each page: -

TPRINT (1, 'Printed at ',JAZZ.$Today, 'Program Aanexml2' MID,  'PAGE' COL(121), JAZZ.$PAGENBR) FOOT;