Skip to content

REPORT-SECTION

The REPORT-SECTION defines the report layout. Typical components of this section include data fields, computed formulas, literal text, and commands.

The following line types are used in the REPORT-SECTION:

H
Header
F
Footer
D
Detail
CBnn
Control Break Line
STnn
Subtotal Line
CTnn
Computed Total

Each of the above line types can be modified by the following:

? Indicates Conditional Line.

This modifier logically controls the execution of the line. To specify the line type as conditional, press the F5 key in the position after the line type and enter conditional logic. A ? character will be appended to the line type designation.

C Command Line.

This modifier allows you to enter Report-IV commands and Thoroughbred Basic syntax. To specify the line type as a command line, append a C character to the line type designator.

/O Omit line if result is blank.

This modifier suppresses the printing of blank lines. To specify the line type, append a /O to the line type designator.

This section provides information on specifications that can be entered in the REPORT-SECTION of a report definition. The commands and variables are arranged alphabetically, and the information for each entry is organized in the following way:

FUNCTION

A brief description of the action or purpose of each command or variable.

SYNTAX

An outline of command or variable structure, including syntax and readability options. Parameter choices are detailed directly following the command.

NOTES

Remarks and important information on command or variable syntax and the function of a command or variable in the REPORT-SECTION.

EXAMPLES

Typical examples of command and variable usage.

Where there is more than one Format for a command, the beginning of each command is shown in boldface letters and the choices are separated by a blank line. In some cases, different command formats are handled in separate sections, e.g., PRINT HELP and PRINT MESSAGE.

As long as the elements within a command are separated by spaces and fall within the command area of a report, no indentation is required. For readability, the syntax is represented with standard indentation to highlight clauses and options under each command.

Note: For more examples of Report-IV commands, declarations, and variables, see the Sample Reports section.

Report-IV commands, also called functions, can be specified either within a formula or directly in the REPORT-SECTION, or both, depending on which command it is and the line type used. Valid Report-IV commands or functions are:

Code Function
(/CTR) Center data to print
/EJECT Page break; form feed
/EJECTnn If less than nn text lines are available on the page, then eject. This function prevents related data fields from breaking across pages.
/FIELD(nn) Temporary area that specifies the actual number of characters (nn) to print for specified Data Name(s)
/LC=n Set line count to n lines. To retrieve current line count use n=/LC
/LINES(n)=dataname n — number of text field lines to print. START =string-expression — start with line containing string-expression END = string-expression — end with line containing string-expression
/O Omit line if blank
(/OLS) Omit leading spaces
(/OTS) Omit trailing spaces
/P To change page character.
/PC=mnemonic Set printer mnemonic defined in the printer table. Example: /PC=ULON For more information, see the Dictionary-IV Administrator Guide
/PN=n Set page number to n. To change the default page number use /PN=string value where string value is any single quoted character. To suppress page numbers use /PN=” “.
/RL=n Set report length to n lines
/SKIP Skip this line
/SPACE Number of spaces

Report-IV special code characters, also called /variables (slash variables), can only be specified in a formula window:

/Variable Purpose
/D System date, DAY.
/d Terminal date.
/F File suffix. For more information on file suffixes, please refer to the Script-IV Developer Guide.
/I Installation name, centered in a 40-character field.
/i Terminal identification.
/O Operator code.
/P or # Page number. Use the # symbol for Header lines only.
/R Report name.
/r Report title, centered in a 40-character field.
/T Current time (12 hour, no seconds, AM/PM).
/t Current time (24 hour).

A data field on the report is created by entering at least one Data Name in the formula window. A formula can contain any Data Name referenced in the ENTRY-SECTION or the FILE-SECTION, Report-IV commands, 3GL functions and variables.

The formula window recognizes the types of information described in the following subsections:

Diagram: Enter Data Field F4- CUST-CODE

This formula places the contents of the Data Name CUST-CODE at the location where the formula was entered.

Diagram: Enter Data Field F4- (BASE-PRICE - ACCTG-COST) * 100 / BASE-PRICE:"###.00%"

This formula places the results of this computation at the location where the formula was entered.

Diagram: Enter Data Field F4- IF CUST-CODE = "ABC" THEN /SKIP

This example shows a conditional formula that is specified on the left margin of a non-command line type in the REPORT-SECTION. The question mark indicating the position of the formula will remain after the formula window is closed. This formula makes this a conditional line.

Diagram: Enter Data Field F4- COMMENTS (/CTR)

The Report-IV command /CTR will print the COMMENTS centered within the length of the field/variables.

Diagram: Enter Data Field F4- /R

The Report-IV variable /R will print the library and report definition name in the following Format: LL-RRRRRR.

/FIELD is used to change the output width of a Data Name. It can also be used within a conditional formula.

SYNTAX

[IF condition THEN] /FIELD(length) = value-1
[ELSE /FIELD(length) = value-2]
condition
an expression or statement, which is tested, to determine whether or not the formula will be calculated.
length
the number of characters used to display the calculated value.
value-1
a Data Name or formula (as described previously) that results in a value.

If the condition is true, this formula displays value-2 in the formula field.

Diagram: Enter Data Field F4- /FIELD(5)=CUST-ZIP

This will reduce the output of the CUST-ZIP field, defined with a length of ten characters to five characters.

Diagram: Enter Data Field F4- IF LEN(CUST-ZIP)(/OTS))=5 THEN /FIELD(14)="SHORT ZIP CODE"

The Report-IV command /OTS will omit trailing spaces for the length calculation. The /FIELD command creates a 14-character workspace which holds the string.

Assume that you want to calculate Gross Profit for an accounting screen. You could define a formula for Gross Profit as follows:

Diagram: Enter Data Field F4- YTD-SALES — YTD-COST

However, if you want to calculate Gross Profit Percent, you need to divide Gross Profit by the YTD-SALES:

Diagram: Enter Data Field F4- (YTD-SALES — YTD-COST)*100/YTD-SALES

Note: A field of asterisks indicates an undefined mathematical function, such as division by zero.

SYNTAX

value-1; IF condition THEN Data Name = value-2 [ELSE...]
value
a Data Name or formula (as described previously) that results in a value.
condition
an expression or statement, which is tested, to determine whether or not the assignment will be performed.

If the condition is true, this formula assigns value-2 to the specified Data Name after it prints value-1. This type of formula is a combination of a data field (value-1) and a conditional assignment. The result of value-1 is output on the report.

Use the formula window as follows:

  1. Locate your cursor at the position or field where you want the results of the formula to appear and press the F5 key. The ? on the line in the REPORT-SECTION indicates where the results of the formula will be positioned on the report.

  2. Enter acceptable Data Name(s), computations, Report-IV commands or variables, or Thoroughbred Basic syntax. You can press one of the following keys:

    F4 Exits the formula window without saving or changing your entry.

    F5 Exits the formula window and saves your entry. This also validates the contents of the formula.

    F10 Displays a lookup of Data Names. You can scroll through the list of Data Names using the

    standard View movement keys. To jump to a selected Data Name in the formula window, press the F10 key when your cursor is in the Data Name display window. You are prompted to enter a key value to jump to, or press the first character of the Data Name to go to.

    Press the Enter key to select the Data Name you want to include in the formula window or press the first letter of the Data Name.

    Press the F5 key to close the formula window and save your changes.

Note: The maximum number of formulas allowed in Report-IV is 1024.

Locate your cursor at the position where the results of the formula are to be written and press the F5 key over the portion you want to revise.

Insert, edit or delete the contents of the formula window.

Exit the formula window and save your changes by pressing the F5 key. If you want to abort the editing and restore the contents of the formula, press the F4 key to cancel and exit the formula editor.

If you have entered a nonexistent Data Name or incorrect syntax, pressing the F5 key to save the data field will result in the following error message:

*Syntax Error, F1 to display, RETURN to continue.

Press the F1 key to see the generated line of code. Standard View movement keys are available. Press F4 to return to the definition window.

If you get this message, check the following:

  • Data Name spelling, including hyphens, spaces and capitalization
  • Masking formats
  • Calculation syntax and logic
  • Data field and formula syntax

FUNCTION

The line types, H, HC and H? enable you to define page headings to be printed on specified pages or on all pages of the report. The line types F, FC and F? enable you to define page footers to be printed on specified pages or on all pages of the report. Formulas and special commands can be included in the header and footer lines.

SYNTAX

H[?|/O] [ text] [formulas]
HC [Report-IV command][Thoroughbred Basic syntax]
F[?|/O] [ text] [formulas]
FC [Report-IV command][Thoroughbred Basic syntax]
?
conditional line modifier
text
any text to be output on the line
formula
any Report-IV formula
Report-IV command
any Report-IV commands
Thoroughbred Basic syntax
any Thoroughbred Basic syntax

NOTES

  • Report-IV provides default header lines containing the following /variables:

    /R Library and Report Name totaling 3 to 8 characters.

    /r The description specified in the Report Definition Header totaling up to 40

    characters.

    Page number totaling 1 to 3 characters. The # symbol can be used only in a header or

    Section titled “Page number totaling 1 to 3 characters. The # symbol can be used only in a header or”

    footer to indicate page number. Elsewhere, use the variable /P in a formula.

    /D Date of report printing totaling 8 characters.

    /T Time of report printing totaling 8 characters.

  • There are no limits to the number of header and footer lines you want to specify.

  • Header and footer lines can contain text, formulas, /variables, or commands. They can be left blank.

  • Quotes (” “) are restricted characters within the entire report definition. One way to print quote characters is to define a Data Name of one character length and set it to QUO in the ENTRY-SECTION. Then use a formula to print the Data Name whenever you want to print quotes.

  • All header lines must be grouped together and all footer lines must be grouped together.

  • It is advisable to place the header lines in the beginning and the footer lines at the end.

  • The # symbol is used to print page numbers in a header or footer line, but can be changed using /P.

  • Data names must not start closer to the left than the “L” in the ruler line.

EXAMPLES

Note: These examples display the use of header lines but they also can apply to footers by substituting the H with an F.

HC /PC=CW12

The C in the HC line allows you to specify a command. Commands can be used to set values, change type styles, and so on. This examples shows a line that sets the Printer to 12 Character Pitch (/PC= is a Printer Code Command).

H? Customers For Salesman: XXXXXXXXXXXXXXXX - XXXXXX
H? Customer/Salesman Synopsis

These represent two conditional header lines. The line is printed only when a specified condition is met. To set the condition, enter H, then press the F5 key. Enter the conditional syntax in the formula window. The ? indicates that this line is conditional. In this example, the first header prints in the body of the report and the second on the synopsis page.

Following are the corresponding formulas:

Condition A:

Diagram: Enter Data Field F4- IF SLSMN = /SPACE THEN /SKIP

Condition B:

Diagram: Enter Data Field F4- IF SLSMN = /SPACE

Conditions A and B would be entered in the header conditional lines, line type H. Condition A would be used in the body of the report while condition B would be used in the synopsis page.

FUNCTION

Detail lines in the REPORT-SECTION are printed for every record that is accessed.

SYNTAX

D[?|/O] [ text] [formulas]
DC [Report-IV command][Thoroughbred Basic syntax]

NOTES

  • Detail lines can contain text, formulas, special code characters (/variables), or commands. They may be left blank.
  • Data names must not start closer to the left than the “L” in the ruler line.

EXAMPLES

D XXXXX ####.00

The first series of characters (XXXXX) holds the place of a string Data Name. The second series of characters (####.00) holds the place of a numeric Data Name.

DC /EJECT3

The command /EJECTn causes the page to be ejected when three or fewer lines remain for text printing on the current page. This prevents related data from breaking across pages.

FUNCTION

Control break lines are lines in the REPORT-SECTION that are only printed when the condition specified in the CONTROL-SECTION is met.

SYNTAX

CBnn[?|/O] [ text] [formulas]
CBnnC [Report-IV command][Thoroughbred Basic syntax]

NOTES

  • Control break lines can contain text, formulas, special code characters (/variables), or commands. They may be left blank.
  • Control breaks are typically used to group different levels of detail.
  • Data names must not start closer to the left than the “L” in the ruler line.

EXAMPLES

CB01 Company: XXXX

The series of X characters holds the place of a string Data Name.

CB01C /PC=ULOFF

The Report-IV command /PC enables users to specify printer control functions. In this example, the underline is set to off.

FUNCTION

Subtotal lines are lines in the REPORT-SECTION that are only printed when the condition specified in the CONTROL-SECTION is met.

SYNTAX

STnn[?|/O] [ text] [formulas]
STnnC [Report-IV command][Thoroughbred Basic syntax]

NOTES

  • Subtotal or total lines can contain text, formulas, special code characters (/variables), or commands. They may be left blank.
  • If you specify entry zero, STnn(0), in the formula in the REPORT-SECTION, the count of the records processed will print. In a one-to-many condition, this includes each of the secondary records. To process only the primary records use a CTnnA.
  • Subsequent accumulators correspond to the position of the Data Names in the ST line in the CONTROL-SECTION. For example, STnn(1) specifies the sum of values for the first Data Name.
  • STnn can be used in formulas on any line type in the REPORT-SECTION. The WHEN condition of the corresponding STnn line controls when the subtotal registers are cleared.
  • Subtotals cannot be defined for local Data Names.
  • Data Names must not start closer to the left than the “L” in the ruler line.

EXAMPLES

CONTROL-SECTION
ST01 WHEN CUST-CODE CHANGES; MTD-SALES, YTD-SALES
ST02 WHEN EOF; MTD-SALES, YTD-SALES
.
.
.
REPORT-SECTION
ST01C /EJECT3
ST01 Month To Date Sales = $###,###.00
ST01 Year To Date Sales = $###,###.00
ST01 Average Monthly Sales = $###,###.00
ST01
ST02 Month To Date Total Sales = $###,###.00
ST02 Year To Date Total Sales = $###,###.00
ST02 Average Total Monthly Sales = $###,###.00

The above example will keep subtotals for MTD-SALES and YTD-SALES in two separate sets of accumulators. Whenever CUST-CODE changes, the ST01 lines in the REPORT-SECTION will be executed and the ST01 accumulators will be cleared. After the last record is read and printed, the ST02 lines in the REPORT-SECTION will be executed.

Note that a page eject will occur when the number of lines specified in the /EJECT will not fit on the page. The end of file, which causes the ST02 lines to print, will result in an unconditional page eject. Note, also, that a subtotal whose condition is EOF is truly a grand total.

The following formulas apply to the example lines:

Diagram: Enter Data Field F4- ST01(1):"$###,###.00"
Diagram: Enter Data Field F4- ST01(2):"$###,###.00"
Diagram: Enter Data Field F4- ST01(2)/ST01(0):"$###,###.00"
Diagram: Enter Data Field F4- ST02(1):"$###,###.00"
Diagram: Enter Data Field F4- ST02(2):"$###,###.00"
Diagram: Enter Data Field F4- ST02(2)/ST02(0):"$###,###.00"

FUNCTION

Computed total lines are lines in the REPORT-SECTION that are only printed when the corresponding condition specified in the CONTROL-SECTION is met.

SYNTAX

CTnn[?|/O] [ text] [formulas]
CTnnC [Report-IV command][Thoroughbred Basic syntax]

NOTES

  • Computed total lines can contain text, formulas, special code characters (/variables), or commands.
  • If you specify entry zero, CTnn(0), in the formula in the REPORT-SECTION, the count of the records selected will print. In a one-to-many conditions this includes the primary records only. To process secondary records, use an STnn line type.
  • If you specify CTnn(1) in the formula window in the REPORT-SECTION, the sum of the value of the first Data Name in the corresponding CTnn line in the CONTROL-SECTION will print.
  • Subsequent accumulators correspond to the position of the Data Name in the CT line in the CONTROL-SECTION. For example, CTnn(1) specifies the sum of values for the first Data Name.
  • CTnn can be used in formulas on any line type in the REPORT-SECTION.
  • CTnn accumulators are not cleared.
  • Data names must not start closer to the left than the “L” in the ruler line.

EXAMPLES

CONTROL-SECTION
CT01A WHEN INVOICE-NUM CHANGES; TOTAL-COMM, TOTAL-SALES
CT01P WHEN INVOICE-NUM CHANGES
REPORT-SECTION
CT01 Total Commission: $###,###.00 Total Sales:$####.00

The masks above represent computed totals specified in formula windows.

Diagram: Enter Data Field F4- CT01(1): "$###,###.00"

The mask above represents the Total Commission.

The specifications are made for the second computed subtotal in the formula window:

Diagram: Enter Data Field F4- CT01(2): "$####.00"

The mask above represents the Total Sales.

From the Report-IV Reference, version 8.9.1. Open this page in the PDF