beautypg.com

5 using program switches – Compaq COBOL AAQ2G1FTK User Manual

Page 89

background image

Developing Compaq COBOL Programs

1.4 Program Run Messages

Example 1–6 (Cont.) Using RMS-CURRENT Special Registers to Detect Errors

(OpenVMS)

DATA DIVISION.
FILE SECTION.
FD

FILE-1.

01

FILE-1-REC.
02

F1-REC-FIELD

PIC 9(9).

FD

FILE-2.

01

FILE-2-REC.
02

F2-REC-FIELD

PIC 9(9).

FD

FILE-3.

01

FILE-3-REC.
02

F3-REC-FIELD

PIC 9(9).

PROCEDURE DIVISION.
DECLARATIVES.
USE-SECT SECTION.

USE AFTER STANDARD EXCEPTION PROCEDURE ON INPUT.

CHECK-RMS-CURRENT-REGISTERS.

DISPLAY "************** ERROR **************".
DISPLAY "Error on file: " RMS-CURRENT-FILENAME.
DISPLAY "Status Values:".
DISPLAY "

RMS-STS = " RMS-CURRENT-STS WITH CONVERSION.

DISPLAY "

RMS-STV = " RMS-CURRENT-STV WITH CONVERSION.

DISPLAY "***********************************".

END DECLARATIVES.
MAIN-PROG SECTION.
MAIN-PARA.

OPEN INPUT FILE-1.
OPEN INPUT FILE-2.
OPEN INPUT FILE-3.
.
.
.
CLOSE FILE-1.
CLOSE FILE-2.
CLOSE FILE-3.
STOP RUN.

END-PROGRAM RMS-CURRENT-SPEC-REGISTERS.

1.5 Using Program Switches

You can control program execution by defining switches in your Compaq
COBOL program and setting them internally (from within the image) or
externally (from outside the image). Switches exist as the environment variable
COBOL_SWITCHES (on the Tru64 UNIX operating system) or the logical name
COB$SWITCHES (on the OpenVMS Alpha operating system).

On OpenVMS Alpha systems, switches can be defined for the image, process,
group, or system.

On Tru64 UNIX systems, switches can be defined for the image or process.

Developing Compaq COBOL Programs 1–59