TITLES

Format window heading line

Source

 

CALL TITLES USING Window-id

Parameters

Window-id

The two character window-id of the window to be formatted.

Copybooks

None

 

Other Requirements

The text items to be formatted need to be bounded by an opening and closing square bracket.

The routine must be performed before the window is first displayed.

Purpose

This routine searches a window for items bounded by an opening and closing square bracket and sets the display attribute to 12 (by default this is usually set to reverse video) the opening and closing square brackets are replaced by spaces. It also centralises all the text found between the square brackets. In Global 3000 almost all windows have a title line and this is achieved via this routine.

There are a number of ways in which variable window headings can be achieved and these are explained in the examples below.

Please note, though no exceptions are returned, some very unusual displays can result if a window containing data items in the title, is passed through the titles routine more than once. Problems can include the highlight disappearing, text becoming de-centralised and stray text appearing.

Exceptions

None

Example

Standard fixed window headings are coded similar to the following.

WINDOW W1
...
01 02 "[ Window - Title ]"
...
ENDWINDOW
PROCEDURE DIVISION
   CALL TITLES USING W1
   DISPLAY WINDOW W1
EXIT

Would be displayed as

Window - Title

 

Variable window headings are trickier. If the headings is set once before the window is first displayed then the following is sufficient.

01 W1TTL
   03 FILLER	PIC X
		VALUE "["
   03 FILLER	PIC X(10)
		VALUE " Account "
   03 Z-OHACC	PIC X(7)
   03 FILLER	PIC X(5)
   03 FILLER	PIC X
		VALUE "]"
WINDOW W1
...
01 02 W1TTL	X(24)	TXT
...
ENDWINDOW
PROCEDURE DIVISION
   MOVE OHACC TO Z-OHACC
   CALL TITLES USING W1
   DISPLAY WINDOW W1
EXIT

Would be displayed as

Window - XXXXXXX

 

If the text within the headings is to be changed each time the window is displayed (usual situation) something similar to the following is required.

01 Z-W1TTL
   03 FILLER	PIC X
		VALUE "["
   03 FILLER	PIC X(10)
		VALUE " Account "
   03 OHACC	PIC X(7)
   03 FILLER	PIC X(5)
   03 FILLER	PIC X
		VALUE "]"
WINDOW W1
...
01 02 W1TTL	X(24)	TXT
...
ENDWINDOW
PROCEDURE DIVISION
   MOVE OHACC TO Z-OHACC
   MOVE Z-M1TTL TO W1TTL
   CALL TITLES USING W1
   DISPLAY WINDOW W1
EXIT

Global 3000 Example

This routine is used in nearly every single Global 3000 Program that displays a window. The best examples are probably those contained in the CS600 to CS660 range of programs (Project Ledger Enquiries). These make heavy use of variable and standard window headings.