12 4 8 Print Control Attributes

LANSA Technical

12.4.8 Print Control Attributes

Print control attributes apply mostly to the UPRINT (unformatted print) command. The PRINT command (and associated DEF_XXXXX commands) facilitates all features described here in different and more advanced ways. Refer to the PRINT and DEF_XXXXX print definition commands for more details.

Also refer to Producing Reports Using LANSA in the Visual LANSA Developer Guide.

The use of the UPRINT command is recommended only for very simple list style reports. For serious application reporting, multilingual reporting or bi-directional language reporting use only the PRINT command.

Attribute

Applies To UPRINT

Applies To PRINT

Description

*NEWPAGE

YES

NO

Indicates that a change of the contents of this field should cause a new page to be started.

*TOTAL  *TOT

YES

NO

Indicates that this field should be subtotaled.

*TOTLVLn   *TOTLEVELn

YES

NO

Indicates that a change to the contents of this field should trigger a subtotal to be printed at "level break" n.

*ONCHANGE

YES

NO

Indicates that this field should only be printed when its contents changes.

*NOPRINT   *NOPRT

YES

NO

Indicates that this field should not be printed.

 

 

Example

Consider a file called ACCOUNTS that contains the following fields and data:

Company (#COMP)

Division (#DIV)

Department (#DEPT)

Expenditure (#EXPEND)

Revenue (#REVNU)

01

1

ADM

400

576

"

"

MKT

678

56

"

"

SAL

123

6784

"

2

ADM

46

52

"

"

SAL

978

456

"

3

ACC

456

678

"

"

SAL

123

679

02

1

ACC

843

400

"

"

MKT

23

0

"

"

SAL

876

10

"

2

ACC

0

43

 

If the file is keyed by #COMP, #DIV and #DEPT, the following RDML program will produce a paginated report with subtotals from this file:

GROUP_BY   NAME(#ACCOUNTS)  FIELDS((#COMP *TOTLEVEL1 

          *NEWPAGE *ONCHANGE) 

          (#DIV  *TOTLEVEL2) 

          (#DEPT  *TOTLEVEL3) 

          (#EXPEND *TOTAL) 

          (#REVNU  *TOTAL))

 

SELECT     FIELDS(#ACCOUNTS) FROM_FILE(ACCOUNT)

UPRINT     FIELDS(#ACCOUNTS)

ENDSELECT

 

ENDPRINT

 

The following points about the field attributes used should be noted:

  • The *NEWPAGE attribute indicates that a new page should be started whenever the company number changes.
  • The *ONCHANGE attribute indicates that field #COMPNO should only ever be printed when it changes.
  • The *TOTLEVELn attributes indicate the total "level breaks" that are required. In this case, totals are required by company, division (within company), and department (within division within company).
  • The *TOTAL attribute indicates the fields that are to totaled. In this case the expenditure and revenue fields are to be totaled.
  • Grand totaling is implicit. Once the *TOTAL attribute is used a grand total line will be automatically produced when the print file is closed (see the ENDPRINT command).