Monday, June 16, 2008

DISPLAY Command

DISPLAY OutputItem1$#il[OutputItem2#il]...
[UPON Mnemonic-Name][WITH NO ADVANCING]

The DISPLAY verb is used to send output to the computer screen or to a peripheral device.

As you can see from the ellipses (...) in the metalanguage above a single DISPLAY can be used to display several data-items or literals or any combination of these.

DISPLAY notes

After the items in the display list have been sent to the screen, the DISPLAY automatically moves the screen cursor to the next line unless a WITH NO ADVANCING clause is present.

Mnemonic-Names are used to make programs more readable. A Mnemonic-Name is a name devised by the programmer to represent some peripheral device (such as a serial port) or control code. The name is connected to the actual device or code by entries in the ENVIRONMENT DIVISION.

When a Mnemonic-Name is used with the DISPLAY it represents an output device (serial port, parallel port etc).

If a Mnemonic-Name is used output is sent to the device specified; otherwise, output is sent to the computer screen.

DISPLAY examples

DISPLAY "My name is " ProgrammerName.
DISPLAY "The vat rate is " VatRate.
DISPLAY PrinterSetupCodes UPON PrinterPort1.

No comments: