Error 94,20 on open statement on a 23 character file namefile

533 Views Asked by At

I'm Importing csv files provided by a third party vendor into a COBOL application. The file names are 23 characters long in .csv format. These files as delivered read successfully and correctly into Excel, Word and Vi.

When I open any of these files using the provided file names I get a COBOL error 94,20 - file not found. This occurs in both SCO OpenServer 5.0.7 (Unix) and Windows 7 runtime environments.

However if I shorten the file name (arbitrarily to 4 characters) I can open, read and close the file with no problems.

Is there a COBOL limit on the number of characters allowed in a sequential input file name? What else might cause such an open failure?

I'm running Micro-focus/ACUCOBOL-GT V7.00 compiler and ACUCOBOL-GT runtime version 5.2.1.

1

There are 1 best solutions below

0
Bela Lubkin On

Older versions of SCO Unix (predecessor of SCO OpenServer) had a 14-character filename limit. If your files are named 'something.csv' then the 'something' part would have been limited to 10 chars.

This limit should not apply on OpenServer 5.0.7. However, if the COBOL you're using was compiled on a much older release, or if it's newer but voluntarily restricts its filename support in an attempt to maintain backwards compatibility, that might be the problem. You could probe this by testing it against 13, 14, 15-char filenames -- well, in general, probe different lengths to learn the actual limit.

Your 5.0.7 system should have the system call tracer command truss(C), and may also have trace(CP) (if you have the C development system installed). Running truss how-you-start-a-cobol-program longfilename.csv may produce useful output, e.g. the actual syscall and system error number which result in the error you see. The OSR5 versions of both truss and trace are moderately flaky (in different ways), so try both. Read their man pages for stuff like the "-o" flag to write output to a file.