action.skip

Style Clause

This clause enables the program to make use of any special effects provided by the printer or output device.

style clause

Style Clause: Coding Rules

  • STYLE may be coded at any level, including in the FD (see Report Files) or RD (see REPORT SECTION and RD). The WHEN condition phrase cannot be used in the FD or RD entry. STYLE cannot be used if the device-name of the corresponding file is NONE.

  • NORMAL may be coded instead of a style-name, meaning that no special effect is to be produced. It must be the only style-name in the clause and there must not be a WHEN condition phrase.

  • Apart from NORMAL, each style-name names a style or special effect that must be obtainable from the output device. The type of output device in use is given in the TYPE phrase of the SELECT statement. The style-names available are either predefined or user-defined for the particular output device. This check, and the processing of the styles themselves, may be delayed until run time by writing DEFERRED in the TYPE phrase. This enables the program to run, in theory, with a variety of different output devices, even when they are widely dissimilar. For a mainframe, special device handling is usually the province of a user-written report file handler - see Installation and Operation. For example, STYLE HIGHLIGHT might be implemented by any of the following means:

    • shadow printing,
    • switching to a different font,
    • printing in larger letters,
    • on a screen, by displaying intense,
    • "double-hammering" on an impact line-printer.
  • The following are standard device-independent style-names. The first two are available with every TYPE of printer (other than TYPE NONE). The last two are available with all printers except the most basic.

    • UNDERLINE causes the report field to be underscored. It is used for headings.
    • HIGHLIGHT causes the report field to stand apart from the others, normally by appearing in bold or intense. It is used to give emphasis to certain fields.
    • ALT-FONT causes the report field to appear in a second contrasting font or typeface, such as italic.
    • GRAPHIC causes the report field to appear in a third contrasting font.

    The remaining style-names used in the examples that follow are purely for the purpose of illustration, and are not necessarily available on any particular device.

  • Style-names are grouped into mutually-exclusive classes. Styles HIGHLIGHT, ALT-FONT and GRAPHIC are mutually-exclusive but UNDERLINE belongs to a separate (one-member) class. The classes are defined in the Printer Description File. It is not valid to code two styles belonging to the same class in the same entry. Thus the following clause is not valid: STYLE IS ALT-FONT GRAPHIC.

    However it is valid to place different members of the same class in nested entries, in which case the prevalent style is noted and restored at the end of the nested entry. Thus, in the following entries, TOMATO is RED while all the other entries are GREEN:

    style green

  • The STYLE clause cannot be repeated in an entry. Hence, if a multiple-choice entry is required, with a different STYLE on each choice, separate entries must be coded.

  • If STYLE is used in a report that uses the PAGE BUFFER feature it should not be coded in a Report Group Description at a level higher than the LINE level.

  • No style-name may be the same as one which is already in effect. For example, the following is illegal:

    COBOL 05 LINE STYLE IS ALT-FONT. 07 COL 1 STYLE IS ALT-FONT UNDERLINE.

  • The STYLE clause cannot be used on an unprintable elementary entry.

Style Clause: Operation

Report writer implements the STYLE feature in one of three ways:

  1. By inserting non-printable control characters, or escape sequences, into the report data, before or after the data affected, or both.

  2. By re-printing a line or part of a line without advancing the carriage. This method is commonly used to highlight text and occasionally to produce an underline effect.

  3. By some special technique chosen and implemented by the user (see Independent Report File Handlers).

The method of implementation of each style is defined explicitly for each TYPE of device, and may be altered by the user.

  • The STYLE clause is transparent to the layout of the report. That is, it does not affect any of the other clauses or entries in the report description. For example, COLUMN numbers are unchanged, even though report writer may be inserting extra control sequences into the report lines. You can therefore simply add STYLE clauses to enhance existing programs.

  • Several STYLE names can be combined in one clause, for example: STYLE HIGHLIGHT UNDERLINE

Here the different characteristics are simply superimposed on each other (but see next item).

  • The scope of the STYLE clause is decided by the level of the entry in which it is coded, thus:

    In an elementary entry, the STYLE clause applies only to the elementary field, for example:

    elementary entry

    In a LINE entry, the STYLE clause applies to the whole line, as in:

    elementary entry 2

    In a report group entry, the STYLE clause applies to the whole group, for example: 01 WARNING-NOTICE TYPE DE STYLE RED ITALIC.

    In an RD entry, the STYLE clause applies to the entire report:

      RD PERSONNEL-SHEETS 
         STYLE IS LANDSCAPE.
    
    If any control characters are output, this happens during the execution of each INITIATE or TERMINATE for the report, or both.

    In an FD entry, the STYLE clause applies to the entire report file:

       FD REPORT-FILE 
          REPORT IS PERSONNEL-SHEETS 
          STYLE IS LOAD-COURIER-FONT-1 LOAD-HELVETICA-FONT-2 
                 SWITCH-ON-SWITCH-OFF.
    
    If any control characters are output, this happens during the execution of each OPEN or CLOSE for the file, or both.

  • The WHEN clause causes the STYLE to take effect only when the condition is true, for example:

    style when

  • Since you can only code STYLE once per entry, you cannot vary the STYLEs in a multiple-choice entry, and instead must code separate entries, as here:

    style once per entry

  • If STYLE is defined on an elementary field that has suppressed zeros or trailing spaces, the STYLE will apply only to the characters printed. For example, the coding:

    style elementary field

    If you do not want this effect, code the STYLE clause at a group level, e.g.

      05 STYLE UNDERLINE. 
        07 COL 11 PIC ZZZZZ9 SOURCE W-PAYMENT.
    

Compatibility

The STYLE clause is unique to new Report Writer.