Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JMP30310I-I OPEN ERROR, FILE=SCHOOL 1

Status
Not open for further replies.

Piotr13

Programmer
Sep 7, 2003
3
IE
JMP30310I-I OPEN ERROR, FILE=SCHOOLS.DAT. ACC-METHODS...

RUNNING COBOL V3, COBOL 85 (PROGRAMMING STAFF) ON WINDOWS XP PRO.

THE CODE IS AS FOLLOWS:

INPUT-OUTPUT SECTION.
FILE-CONTROL.
* declare schools file
SELECT schools-file ASSIGN TO "SCHOOLS.DAT"
ORGANIZATION IS INDEXED
RECORD KEY IS s-code-key
ACCESS MODE IS RANDOM
FILE STATUS IS file-status.

DATA DIVISION.
FILE SECTION.
* describe schools file
FD schools-file.
01 school-record.
03 s-code-key.
05 s-code PIC XXX999.
88 exit-key VALUE ZERO.
03 s-name PIC X(20).
03 s-street-name PIC X(15).
03 s-town PIC X(10).
WORKING-STORAGE SECTION.
01 file-status.
03 fiel-status-1 PIC X.
03 file-status-2 PIC X.
01 REDEFINES file-status PIC XX.
88 file-access-ok VALUE "00".
01 option PIC 9.
88 valid-option VALUE 0 THRU 1.
88 exit-option VALUE 0.
88 add-option VALUE 1.
01 reply PIC X.
88 valid-reply VALUE "Y", "y", "N", "n".
88 yes-reply VALUE "Y", "y".
PROCEDURE DIVISION.
control-procedure.
OPEN I-O schools-file
PERFORM get-option
PERFORM menu UNTIL exit-option
CLOSE schools-file
STOP RUN.

 
IF you do not have the file created you need to check for the file-status after the open.

e.g.

OPEN I-O schools-file
if file-status = "whatever code it is" (not "00")
open output schools-file
close schools-file
open I-O schools-file
end-if

You will also need to use declaratives to be able to trap this particular error.




Regards

Frederico Fonseca
SysSoft Integrated Ltd
 
Is there more to your error message than you gave us. Usually the file status code is displayed in the error message.

If you file already exists, you may have a definition problem where you program does not match the layout of the physical index file. You need to know what the file status code was in order to get more specific which what the problem is.

In Frederico's response, be careful. Just because the file status flag is not '00' does not mean the file does not exist. Frederico's example will assume that any error means the file does not exist and will open it for output overlaying any file that may already exist.

etom
 
Sorry Frederico,

Miss read your code. Piotr13, what I was trying to say, the file status code for file not found is '35'. Do not just check of a non zero code.

etom
 
No problem Etom,

I was too lazy to see the value on the manual and wasn't sure if it was 35 or not, hence my "whatever code"

Piotr13
Just to be completely accurate every code with a "0" on the first position is not an error, but an information of a sucesseful operation.
If the the second digit is NOT "0" then further information was available as result of the operation (e.g. 02 means that a record was created that resulted in a duplicated key, which is not an error if a key allows duplicates)




Regards

Frederico Fonseca
SysSoft Integrated Ltd
 
OPEN I-O schools-file
if file-status = "whatever code it is" (not "00")
open output schools-file
close schools-file
open I-O schools-file
end-if

After closing the file and program and starting this againe the previous information is erased by the "open output" Statement. What is the solution to this one
 
Piotr.

IF you read your manuals, you will find in one of them the values for the file-status.

As etom mentioned the specific value for "file not found" is "35".

So the above code you should test for = "35" to do the code INSIDE the IF.




Regards

Frederico Fonseca
SysSoft Integrated Ltd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top