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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

aix cobol

Status
Not open for further replies.

schmallen

MIS
Jul 30, 2002
3
US
I am trying to read a file in COBOL and keep getting the following error. I can write to a file without any problems, just can't read. I am sure it is just something that I am missing, just can't figure out what it is.

IWZ200S Error detected during OPEN for file 'LOOK-FILE'. File status is: 35.
File system indicated: File Not Found.
Message routine called from offset 0x490 of routine _iwzCallUseProc.
_iwzCallUseProc called from offset 0xea8 of routine _iwzSeqOpen.
_iwzSeqOpen called from offset 0x354 of routine _iwzGenricOpen.
_iwzGenricOpen called from offset0x170 of routine READ-TAPE.

THE FILE:
$ ls -lt try.dat
-rwxrwxrwx 1 aaaaa staff 50 Jul 22 14:06 try.dat

THE CODE:
FILE-CONTROL.
SELECT LOOK-FILE ASSIGN TO 'try.dat'
* (also tried complete path name '/home/aaaaa/try.dat'
ORGANIZATION IS SEQUENTIAL
ACCESS MODE IS SEQUENTIAL.
* FILE STATUS IS FS-CODE, FILESYS-CODE.

OPEN INPUT
LOOK-FILE.
also tried using the set
set try=/home/aaaaa/try.dat

SELECT LOOK-FILE ASSIGN TO try





 
It is possible that the file written to is not where you think it is.

My suggestion is that you isolate the problem by making the whole process simpler:
Write to a file at a more unambiguous location such as C:\try.dat. And, try to find it and make sure it exists, after you write and close the file.

There is more than one way of misunderstanding the real location of a file. [smile]

Keep me updated.

Dimandja
 
Try inserting DISK in the select statement. It looks as though compiler may be defaulting to tape.

Steve Hall
 
more info : this is COBOL on a RS6000. I have no problem writing a file just reading. For some reason it cannot find the file needed to read.

I am trying to read a file in COBOL and keep getting the following error.  I can write to a file without any problems, just can't read.  I am sure it is just something that I am missing, just can't figure out what it is.
        IWZ200S Error detected during OPEN for file 'LOOK-FILE'.  File status is: 35.
              File system indicated: File Not Found.
              Message routine called from offset 0x490 of routine _iwzCallUseProc.
             _iwzCallUseProc called from offset 0xea8 of routine _iwzSeqOpen.
             _iwzSeqOpen called from offset 0x354 of routine _iwzGenricOpen.
             _iwzGenricOpen called from offset0x170 of routine READ-TAPE.
THE FILE:
$ ls -lt try.dat
-rwxrwxrwx   1 aaaaa   staff         50 Jul 22 14:06 try.dat
THE CODE:
     FILE-CONTROL.                                                            
            SELECT LOOK-FILE    ASSIGN TO 'try.dat'
      *    (also tried complete path name   '/home/aaaaa/try.dat'
            ORGANIZATION IS SEQUENTIAL
            ACCESS MODE IS SEQUENTIAL.                                    
      *      FILE STATUS IS FS-CODE, FILESYS-CODE.
 
         OPEN INPUT
                LOOK-FILE.
also tried using the set
          set try=/home/aaaaa/try.dat
          SELECT LOOK-FILE    ASSIGN TO try
 

1. Does the program create a new file when it WRITEs, as opposed to using an already existing file?

2. Are the WRITE and the READ statements executing in the same program unit, during the same execution session?

What I am driving at is lets isolate the problem. Try to code TWO SELECT statements, in the same program unit, pointing to the same file. Then, OPEN and WRITE and CLOSE the appropriate file handle. Then, before STOP RUN, try to OPEN and READ the same file using the appropriate file handle.

Keep me posted.

Dimandja
 
Dimandja
I tried your suggestion and it worked, I can read the file that I had just written in the same program. Thought maybe it was a permit error and set the permits of a different file to the same as the new file, No go, same error. Tried reading the new file from a different program. No problem I could read it. So where from here.

Schmallen
 
Schmallen,

Is there any difference in the SELECT statement, or the mode or environment of execution, parameters, etc... between the program that can find and read the file and the one that fails?

Dimandja
 
Hello,

I just read the problems about running and OPENing a simple sequential file in a COBOL program in AIX. I've the same problems and I'm NOT able at all to run the program although I tried out all the suggestions in your mail. I even gave all the names in FD, USING, etc, the same and only filename, so the system should find the file anyway, but no change; the problem persists: at OPEN, the system cannot find the file (error 35), however the file IS in the current directory and all permissions are set correctly. Does anyone have the solution? I read that some of you CAN read a file. May be I have to use another compiler, flags or whatelse is may be. It seems as the system doesn't search in the directory at all.
Help me, please because it's very frustrating wasting all the time for something that should be very easy.

HB.
hbl@jeems.nl
 
Hi xyzxyz,

This seems to be a baffling situation, to say the least.

Anyway, since I don't have your installation, I can only depend on what you tell me. I reread this thread, especially the last message from schmallen.

He seems to be saying that a file created (OPEN OUTPUT) by his COBOL program can be read by any COBOL program. He seems to say that he can write to a file (I suspect this file was opened for OUTPUT by COBOL).

This would indicate that files created by some other tool (not COBOL) on this system are not accessible to COBOL.

We can try to solve this puzzle this way:
1. Create a file through COBOL (OPEN OUTPUT), and see if this file can be opened for INPUT by any COBOL program.
2. Tell us how the files that COBOL cannot access were created (what tools were used in the file creation).

Dimandja
 
Hello Dimandja,

Here’s a part of the program (ANVR03):

001000 FILE-CONTROL.
001100 SELECT AF-FILE ASSIGN AFTEST.
001200 DATA DIVISION.
001300 FILE SECTION.
001400 FD AF-FILE
----
----

043900 F01AF. OPEN INPUT AF-FILE.
…..
…..

046400 F05AF-10. READ AF-FILE AT END
046500 MOVE 1 TO AF-FT.

AIX files:
------------------------------
kzin /home/root ls -l A*
-rwxr-xr-x 1 root system 24182 Nov 21 08:33 ANVR03
-rw-r--r-- 1 root system 30600 Nov 21 11:54 AFTEST

File AFTEST is an ordinary flat-file

UNIX commands:
----------------------

kzin /home/root >export AFTEST=/home/root/AFTEST
kzin /home/root >ANVR03
IWZ200S Error detected during OPEN for file 'AF-FILE'. File status is: 35. File system indicated: File Not
Found.
Message routine called from offset 0x490 of routine _iwzCallUseProc.
_iwzCallUseProc called from offset 0xff0 of routine _iwzSeqOpen.
_iwzSeqOpen called from offset 0x2d4 of routine _iwzGenericOpen.
_iwzGenericOpen called from offset 0x1bc of routine ANVR03.
IWZ901S Program exits due to severe or critical error.
IOT/Abort trap

Alternate methods:
-----------------
I always tried “ SELECT ….. ASSIGN USAGE fieldx “, moving the pathname to fieldx before OPENing the file as well as ….
assigning the name AFTEST to all descriptions of the file; so they are equal in the program and physical in the path/directory.


Regards.
xyzxyz
 
Hi xyzxyz,

Before we can get to the code, I still need these issues resolved:

1. Create a file through COBOL (OPEN OUTPUT), and see if this file can be opened for INPUT by any COBOL program.

2. Tell us how the files that COBOL cannot access were created (what tools were used in the file creation).

Dimandja
 
As for case sensitivity, you may have to enclose the file name in quotes.
 
Hi, IBM cobol I presume?

Please try this:
Select cobolseqfile assign to
"STL-/home/JohnDoe/ibmcobol/cobolseqfile"
organization is sequential
file status w-FileSeqStatus.

for sequential files and this:

Select cobolLseqbestand assign to
"NAT-/home/JohnDoe/ibmcobol/cobolLseqbestand"
organization is line sequential
file status w-FileLSeqStatus.

for line-sequential files.

The "STL-" and "NAT-" force IBMcobol to activate a certain filesystem for those files.

Succes
 
Hello Truusvlugindewind (and other supporters),

Yes, IBM COBOL! We tried your suggestion:

Select af-file assign to "/home/root/AFTEST"
organization is sequential
file status affilestatus

AND IT WORKS !!!! May be the phrase "organisation is ..." is crucial; we don’t know. Writing to a Sybase database is another story. With this code we also want to make the path to the physical file more flexible by coding "select ... using .." and "select ... export_variable". You'll hear the results. For now thanks to ALL of you for your support.

Regards,
 
Hi xyzxyz,

I don't think the phrase "organisation is ..." is crucial; this is the COBOL default. As Truusvlugindewind says, "The "STL-" and "NAT-" force IBMcobol to activate a certain filesystem for those files". I also suspect that using quotes around the filepathname preserves the case sensitivity which is prevasive in the AIX.

Dimandja

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top