HP OpenVMS Systems

ask the wizard
Content starts here

RMS, COBOL and OPCDEC error?

» close window

The Question is:

 
Why can't I READ this indexed file?
 
Under Compaq Cobol v 2.7:
 
The program opens an indexed file for input but the READ fails with the
 following run-time error:
 
%SYSTEM-F-OPCDEC, opcode reserved to Digital fault at PC=000000007C29C9D4,
 PS=0000001B
%TRACE-F-TRACEBACK, symbolic stack dump follows
  image    module    routine             line      rel PC           abs PC
 DEC$COBRTL                                 0 000000000002C9D4 000000007C29C9D4
 DEC$COBRTL                                 0 00000000000276B0 000000007C2976B0
 STATE_TEST  STATE  STATE                  35 0000000000000104 0000000000030104
 STATE_TEST                                 0 0000000000020370 0000000000030370
                                            0 FFFFFFFF802573F4 FFFFFFFF802573F4
 
The file is OPENed successfully according to the status code.  I've tried using
 the fully qualified file name and it doesn't seem to make a difference.
 
Here is a sample of the code:
IDENTIFICATION DIVISION.
PROGRAM-ID.     STATE.
 
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
    SELECT STATE-FILE ASSIGN TO "STATE.DAT"
           ORGANIZATION IS INDEXED
           ACCESS MODE IS DYNAMIC
           RECORD KEY IS STATE-KEY
           FILE STATUS IS STATESTATUS.
 
 
DATA DIVISION.
FILE SECTION.
FD STATE-FILE.
01  STATE-RECORD.
    02 STATE-KEY        PIC X(02).
    02 STATE-INDEX      PIC 9(02).
    02 STATE-NAME       PIC X(14).
 
 
WORKING-STORAGE SECTION.
01  ENDOFFILE   PIC X(1).
01  STATESTATUS PIC X(2).
 
PROCEDURE DIVISION.
 
001-START-HERE.
    OPEN INPUT STATE-FILE.
 
    MOVE "AL" TO STATE-KEY.
    DISPLAY SPACE LINE 1 COLUMN 1 ERASE TO END OF SCREEN.
    READ STATE-FILE
        INVALID KEY DISPLAY "BAD KEY".
 
    CLOSE STATE-FILE.
    STOP RUN.
 
 
 


The Answer is :

 
  Please first ensure you have the COBRTL V2.7 (or later) kit installed:
 
$ product show history cob*
----------------------------------- ----------- ----------- --------------------
PRODUCT                             KIT TYPE    OPERATION   DATE AND TIME
----------------------------------- ----------- ----------- --------------------
DEC AXPVMS COBOL V2.7-1209          Full LP     Install     30-APR-2001 07:04:32
DEC AXPVMS COBRTL V2.7-603B         Full LP     Install     30-APR-2001 07:03:22
----------------------------------- ----------- ----------- --------------------
 
  Next, please try compiling /CHECK, rebuild, and rerun the program.
  /CHECK includes some additional run-time verifications between the
  program description of the indexed file keys and the actual file.
 
  Also please use ANALYZE/RMS to verify the structure of the file.
 
  If you are still unable to resolve the problem, please contact the
  Compaq Customer Support Center.   The Support Center will require
  a command procedure that can be used to generate the indexed input
  file you are using, or a copy of the indexed file.
 
  The following example will create the indexed file from within the
  COBOL program, though the following program was unsuccessful in
  duplicating the problem you are reporting.  Accordingly, the OpenVMS
  Wizard also suspects the problem might be related to specific data
  present in your file.
 
  The Customer Support Center will also want to know if you have been
  able to read this file on older versions of OpenVMS, with older
  versions of COBOL, or with other programming languages on OpenVMS V7.3.
 
    --
 
IDENTIFICATION DIVISION.
PROGRAM-ID.     STATE.
 
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
    SELECT STATE-FILE ASSIGN TO "STATE.DAT"
           ORGANIZATION IS INDEXED
           ACCESS MODE IS DYNAMIC
           RECORD KEY IS STATE-KEY
           FILE STATUS IS STATESTATUS.
 
DATA DIVISION.
FILE SECTION.
FD STATE-FILE.
01  STATE-RECORD.
    02 STATE-KEY        PIC X(02).
    02 STATE-INDEX      PIC 9(02).
    02 STATE-NAME       PIC X(14).
 
WORKING-STORAGE SECTION.
01  ENDOFFILE   PIC X(1).
01  STATESTATUS PIC X(2).
 
PROCEDURE DIVISION.
 
001-START-HERE.
    OPEN OUTPUT STATE-FILE.
    CLOSE STATE-FILE.
    OPEN INPUT STATE-FILE.
 
    MOVE "AL" TO STATE-KEY.
    DISPLAY SPACE LINE 1 COLUMN 1 ERASE TO END OF SCREEN.
    READ STATE-FILE
        INVALID KEY DISPLAY "BAD KEY".
 
    CLOSE STATE-FILE.
    STOP RUN.
 

answer written or last revised on ( 17-SEP-2001 )

» close window