There really have been a whole heap of complicated solutions offered to
this.  I'm glad you have something working, but I'll just suggest the
simplest, most efficient way to tell if an OS pathname exists in UniData is
this:

IF DIR(PATHNAME) THEN
* exists
END ELSE
* doesn't
END

Since you don't want to actually count the number of entries in this
directory, simply check for the existence of one particular file, I'd go
with DIR - much more efficient in a polling scenario than anything else
offered.

So you could just code:

IF DIR("D:\Roi\PLACON.MAIN\INBOUND.EDI\EDI.TXT") THEN ...

Or you could make it location independent by setting up a DIR pointer called
"INBOUND.EDI" in your VOC and pointing it at D:\Roi\PLACON.MAIN\INBOUND.EDI
as others have suggested and then OPENing this and using FILEINFO() to
retrieve the actual pathname:

COMMON /EDI/ INBOUND_PATH

IF INBOUND_PATH ELSE
        OPEN "","INBOUND.EDI" TO TMPFV THEN
                INBOUND_PATH = FILEINFO(TMPFV, 2)
                CLOSE TMPFV

                IF INDEX(UPCASE(SYSTEM(33)),"WIN",1) THEN
                        INBOUND_PATH := "\"
                END ELSE
                        INBOUND_PATH := "/"
                END
                INBOUND_PATH := "EDI.TXT"
        END
END
IF INBOUND_PATH AND DIR(INBOUND_PATH) THEN
* process inbound EDI
END

Cheers,

Ken

> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Behalf Of
> [EMAIL PROTECTED]
> Sent: Wednesday, 23 June 2004 4:35 AM
> To: [EMAIL PROTECTED]
> Subject: RE: [U2] Counting the number of files in a directory
>
>
> That got me on the right track, thanks.  I don't know about
> other U2 systems, but UniData required DIR instead of F in
> the first line of the VOC entry.  Everything else was the same though.
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, June 22, 2004 11:07 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [U2] Counting the number of files in a directory
>
>
> In a message dated 6/22/2004 8:47:20 AM Pacific Daylight Time,
> [EMAIL PROTECTED] writes:
>
>
> >   I can handle running the 2 functions and scheduling the
> program to run
> > every 30 seconds or so, but I'm not quite sure how to poll
> the directory.  The
> > directory is D:\Roi\PLACON.MAIN\INBOUND.EDI and the file I
> want to check for
> > is EDI.TXT and return a true/false (1/0) to decide whether
> to continue
> > processing.  Can anyone give me an example of this?  Thanks
> in advance.
-------
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to