Subject: | |
From: | |
Reply To: | |
Date: | Mon, 8 Jun 1998 18:06:24 -0500 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
At 06:32 PM 6/8/98 -0400, Jim Gilbert wrote:
>anyone know a really simple way to programatically (in Cobol) check to see
>if a file exists? I thought I was gonna be smart and just run the command
>intrinsic and set a var with the results, but that didn't seem to work out
>for me.
Try issuing the command 'SETVAR FILE_EXIST FINFO("<filename>","EXISTS")'
and then obtaining the var 'FILE_EXIST'. If it is zero, the file does
not exist.
Another simply way I've found is by calling the FLABELINFO intrinsic for
one option, such as filecode. This is basically what the command processing
is doing and is faster than performing an FOPEN and dealing with access
option issues/etc. It is probably also faster than using the 'setvar'
technique
outlined above which uses 2 intrinsic calls (e.g. HPCOMMAND and HPCIGETVAR).
/jf
_\\///_
(' o-o ')
___________________________ooOo_( )_OOoo____________________________________
Monday, June 8th
Today in 1917 - The first American troops landed in England
in World War 1 under the command of Gen. Pershing.
___________________________________Oooo_____________________________________
oooO ( )
( ) ) /
\ ( (_/
\_)
|
|
|