BLDPRTLIN BUILD PRINT LINE TAACLPI |
The Build Print Line command formats a print line within a CL
program. It is intended for use with the TAA Tool PRINT. When used
with the PRINT command, the advantages are:
** The formatting of the line can be done by specifying print
positions instead of counting blanks or using concatenation.
** Numeric fields can be handled properly by use of edit codes.
The following shows some typical printed output from the combination
of the BLDPRTLIN and PRINT commands.
***********************************************************************
* *
* 2/27/09 11:14:09 SYSTEM1 Customer report *
* *
* Number Customer name Owed Sales Last order *
* *
* 02467 Johnson and Co. 12.00 300.15 1/26/09 *
* 37865 Miller and Sons 458.12 1,000.00 2/01/09 *
* *
* 470.12 1,300.15 *
* *
* Records printed- 2 *
* *
***********************************************************************
Note that the column headings are left aligned for the character
fields and right aligned for the numeric fields. You can do either.
The totals must be accumulated in CL and an extra line printed.
The following is the prompt screen for the BLDPRTLIN command:
**********************************************************************
* *
* LINE parm to return (132) . . . . ___________ *
* Format for char fields _ *
* Char var or literal (up to 50) _________________________ *
* Print position (1 132) . . . . ___ *
* Align left or right . . . . . . L *
* + for more _ *
* Format for dec fields _ *
* Dec variable or literal ____________________ *
* Units print position (2 131) ___ *
* Number of decimals 0 *
* Edit code . . . . . . . . . . . J (J K L M W Y Z) *
* + for more _ *
* *
**********************************************************************
The BLDPRTLIN command supports two lists. One is for the character
fields and one for the numeric fields. The command prompt appears
with one character and one decimal field. The normal + symbol is
used to request additional fields.
The following is the CL code to produce the previous report.
/* All numeric fields passed to BLDPRTLIN */
/* must be specified as 0 decimals. The */
/* number of decimal positions that */
/* print is controlled by a parameter. */
DCL &OWED *DEC LEN(7 0)
.
.
.
/* Build and print heading */
BLDPRTLIN LINE(&LINE) CHARFLDS(('Number' 001) +
('Customer name' 010) ('Owed' 037 R) +
('Sales' 051 R) ('Last order' 065 R))
PRINT ACTION(*OPN) TITLE('Customer report') +
COLHD1(&LINE) SPLFNAME(CUSTOMERS)
.
. /* Detail print loop */
.
/* Build and print detail line */
BLDPRTLIN LINE(&LINE) CHARFLDS((&NUMBER 001) (&NAME +
010)) DECFLDS((&OWED 037 2) (&SALES 051 2) +
(&DATE 065 0 Y))
PRINT LINE(&LINE)
/* Add up totals */
CHGVAR &OWEDT (&OWEDT + &OWED)
CHGVAR &SALEST (&SALEST + &SALES)
.
.
.
/* Build and print total line */
BLDPRTLIN LINE(&LINE) DECFLDS((&OWEDT 037 2) (&SALEST +
051 2))
PRINT LINE(&LINE) SPCBFR(1) COUNT(*NO)
/* Close print file */
PRINT ACTION(*CLO)
The sequence of the specifications determines the order in which the
data will be moved to the print line work area. This may cause
overlaying of previous entries. In general you should specify a left
to right order of the entries.
You can use the multiple column head capability of the PRINT command.
You can offset the column heads by specifying different print
positions. For example:
BLDPRTLIN LINE(&COLHD1) CHARFLDS(('Customer' 001)
.
BLDPRTLIN LINE(&COLHD2) CHARFLDS(('Number' 002)
.
PRINT ACTION(*OPN) TITLE('Customer report') +
COLHD1(&COLHD1) COLHD2(&COLHD2)
to produce a heading of:
Customer
Number
When you modify an existing command to delete or add a new sub-list
(e.g. a field in the BLDPRTLIN command), you should consider the use
of the prompter values > and <. Using the < symbol will cause the
proper deletion of a sub-list. If you erase the entries, the
prompter may return a null value for one of the sub-lists. The null
sub-list will be bypassed by the command processing routine, but the
null value will appear in your source.
Command parameters *CMD
------------------
LINE The return variable which will contain the formatted
line. It must be specified as 132 bytes.
CHARFLDS The character fields. This is a list of up to 35
sub-lists. Each sub-list has the following
definition:
CHARVAR The character variable or literal to be
printed. The length of the value can be up to
50 bytes. The value is aligned according to
the ALIGN parameter.
POSITION The position where the value will start
printing. The value is left or right aligned
according to the ALIGN parameter. POSITION is
entered as a numeric value.
ALIGN Align left or right. 'L' is the default and
'R' may be specified. Normally you would use
'L' for character fields and 'R' for numeric
fields.
DECFLDS The decimal fields. This is a list of up to 35
sub-lists. Each sub-list has the following
definition.
DECVAR The decimal variable or literal to be printed.
The length of the value can be up to 15 digits.
The fields must be specified as 0 decimals.
The number of decimals that print is controlled
by the NBRDEC parameter.
POSITION The units position where the value will print.
POSITION is entered as a numeric value. If the
value in DECVAR is minus, there will be a minus
sign to the right of the units position.
NBRDEC The number of decimal positions in the numeric
value. The default is 0. The DECVAR parameter
must always be specified as 0 decimals. The
NBRDEC parameter controls where the decimal
character will appear when edited.
EDTCDE The edit code to be used. The default is J.
The values J K L M W Y Z may be entered. These
are the standard system values with the
following exceptions:
- 'W' is for time editing and inserts a
colon (e.g. 8:15:00).
- The W Y and Z edit codes require NBRDEC to
be 0.
- A minus sign will always print on the
right if the field is negative.
Prerequisites
-------------
The following TAA Tools must be on your system:
EDTVAR Edit variable
EXTLST Extract list
MOVCHRDEC Move character to decimal
SNDESCMSG Send escape message
Implementation
--------------
None, the tool is ready to use.
Objects used by the tool
------------------------
Object Type Attribute Src member Src file
------ ----- --------- ---------- -----------
BLDPRTLIN *CMD TAACLPI QATTCMD
TAACLPIC *PGM CLP TAACLPIC QATTCL
|
Added to TAA Productivity tools April 1, 1995