| Author |
Testing external file existance
|
|
| Kris Dames 2004-07-15, 8:55 pm |
| I use rmcobol85 on redhat linux and I need a way to verify from within
my program that a user-specified file exists in a specific location on
the filesystem. For example, if the user inputs the filename
"myfile.txt" I need to check the /tmp directory for the file and tell
the user if the file exists or not. Any help would be appreciated!
Thanks
Kris Dames
| |
| Donald Tees 2004-07-15, 8:55 pm |
| Kris Dames wrote:
> I use rmcobol85 on redhat linux and I need a way to verify from within
> my program that a user-specified file exists in a specific location on
> the filesystem. For example, if the user inputs the filename
> "myfile.txt" I need to check the /tmp directory for the file and tell
> the user if the file exists or not. Any help would be appreciated!
>
> Thanks
> Kris Dames
Try to open it in input, and check the file status. The ussual is for
"29" to signal a file not being there.
Donald
| |
| Frederico Fonseca 2004-07-15, 8:55 pm |
| On 15 Jul 2004 12:59:49 -0700, kjdkld@hotmail.com (Kris Dames) wrote:
>I use rmcobol85 on redhat linux and I need a way to verify from within
>my program that a user-specified file exists in a specific location on
>the filesystem. For example, if the user inputs the filename
>"myfile.txt" I need to check the /tmp directory for the file and tell
>the user if the file exists or not. Any help would be appreciated!
issue a "call "SYSTEM" using command-line" where command line is made
as
01 command-line pic x(2000).
......
accept file-name
string "ls -l "
file-name
" > /tmp/temp-file"
into command-line
call "system" using...
At this stage you read the "/tmp/temp-file" as a normal sequential
file and see if the file-name value appears there.
If so you can open that file.
Frederico Fonseca
ema il: frederico_fonseca at syssoft-int.com
| |
| JerryMouse 2004-07-16, 3:55 am |
| Kris Dames wrote:
> I use rmcobol85 on redhat linux and I need a way to verify from within
> my program that a user-specified file exists in a specific location on
> the filesystem. For example, if the user inputs the filename
> "myfile.txt" I need to check the /tmp directory for the file and tell
> the user if the file exists or not. Any help would be appreciated!
>
Open the file. If you get an error, chances are the file's not there.
| |
| Richard 2004-07-16, 3:55 am |
| Frederico Fonseca <real-email-in-msg-spam@email.com> wrote
> string "ls -l "
> file-name
> " > /tmp/temp-file"
> into command-line
That should be terminated by also having x"00" (or other low-value) as
an item to stringed at the end.
| |
| Kris Dames 2004-07-16, 8:55 am |
| Those are great ideas. My thanks to all of you!
|
|
|
|