Highlighted
Absent Member.
Absent Member.
8307 views

I'm getting this error!

Jump to solution

I tried using that app configuration file that chris glazer sent  (i think that's his name) for another program and it gave me a wrong mode error what modes it suppose to be in

the only thing I can think that is different is this line in my code

organization is line sequential.

im not sure that's any mode or not

0 Likes
1 Solution

Accepted Solutions
Highlighted
Absent Member.
Absent Member.

sorry about the posts being so hard to follow I would reply before you answered back

anyway you said it might be the actual file format what do you mean by that

could it be this my phone.txt  doesn't have an extension field in it but the report.cbl has or requests that record or field

View solution in original post

0 Likes
19 Replies
Highlighted
Absent Member.
Absent Member.

well its got nothing to do with this code

ORGANIZATION IS LINE SEQUENTIAL

the only thing I can think of is there a read statement in my code maybe that has something to do with it

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

This error is a file handling error that would happen if you were trying to read a record that was shorter in the physical file than how it is defined in the program so the logical file in the program is probably difined differently than how it exists on disk.

Either that or you are trying to read from a file opened for output or extend, which isn't supported.

What statement is at these line numbers:

at Void  REPORT._MF_PERFORM_4_1() in C:\Users\titor\documents\visual studio 201

0\Projects\Report\Report\Program1.cbl:line 89

at Int32  REPORT.REPORT() in C:\Users\titor\documents\visual studio 2010\Projec

ts\Report\Report\Program1.cbl:line 51

If this is a line sequential file and has CRLF at the end of each record then you need to define it as LINE SEQUENTIAL as a standard file defined as SEQUENTIAL does not use these delimiters.

How is this file created, through COBOL or through other means?

Look at the file in a text editor like notepad.

What is the length of each record?

0 Likes
Highlighted
Absent Member.
Absent Member.

here's one definition

      01 FIELDS-TO-PRINT.

          05 PROMPT-1                          PIC X(4)       VALUE "Lst:".

          05 PRINT-LAST-NAME                   PIC X(20).

          05 PROMPT-2                          PIC X(4)       VALUE "1st:".

          05 PRINT-FIRST-NAME                  PIC X(20).

          05 PROMPT-3                          PIC X(3)       VALUE "NO:".

          05 PRINT-NUMBER                      PIC X(15).

          05 PROMPT-4                          PIC X(4)       VALUE "Xtn:".

          05 PRINT-EXTENSION                   PIC X(5).

      01  END-OF-FILE                          PIC X.

      01  PRINT-LINES                          PIC 99.

0 Likes
Highlighted
Absent Member.
Absent Member.

Heres the other definitions:

      01 PHONE-RECORD.

          05 PHONE-LAST-NAME                   PIC X(20).

          05 PHONE-FIRST-NAME                  PIC X(20).

          05 PHONE-NUMBER                      PIC X(15).

          05 PHONE-EXTENSION                   PIC X(5).

      FD PRINTER-FILE

         LABEL RECORDS ARE OMMITTED.

      01 PRINTER-RECORD                        PIC X(80).

sorry about that I messed up

0 Likes
Highlighted
Absent Member.
Absent Member.

how do you put a text file in a reply

oh I think I figured it out

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

So the error is on the read statement as shown here:

       READ PHONE-FILE NEXT RECORD

              AT END                           line 89

              MOVE "Y" TO END-OF-FILE.

So either the record is defined as the incorrect size to what is actually on the disk or you are not opening the file in a mode that can support a read.

Your record for your phone file is defined as 60 characters according to the definitions.

My guess is that one of the following is happening:

1. you are creating the file in this program using open extend and then you are trying to read it back without first closing it and opening it for input.

2. you created the file as sequential type and are trying to read it back as line sequential.

Can you please attach the program so that I can review it?

Thanks.

0 Likes
Highlighted
Absent Member.
Absent Member.

Here ya go

I think the phone file is a sequential file

and I'm trying to read line sequential

how would  I fix that

boy you know your cobol

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

That looks ok so it must be the actual file format.

Can you please attach phone.dat?

0 Likes
Highlighted
Absent Member.
Absent Member.

ok it gave me this error when I changed the printer file to sequential instead of line sequential

Unhandled Exception: COBOLFileHandlingException

'phone.dat' : 9/018 (ANS74)

18     Read part record error: EOF before EOR or file open in wrong mode

at Void  REPORT._MF_PERFORM_4_1() in C:\Users\titor\documents\visual studio 201

0\Projects\Report\Report\Program1.cbl:line 89

at Int32  REPORT.REPORT() in C:\Users\titor\documents\visual studio 2010\Projec

ts\Report\Report\Program1.cbl:line 51

at Int32  REPORT._MF_ENTRY()

Press any key to continue . . .

0 Likes
Highlighted
Absent Member.
Absent Member.

I guess its saying its end of file before end of read maybe its my definitions I have maybe you can figure it out I can't seem to

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

You can't just change the file definition without knowing what type of file it is.

Where did phone.dat come from?

Can you please attach phone.dat so I can look at it?

Thanks.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.