You don't need to do the touch command.  If the OPENSEQ takes the ELSE
branch, but the content of STATUS() is 0, the file does not currently exist,
but you can still WRITESEQ to the file handle, and the file will be created.

Larry Hiscock
Western Computer Services
http://www.wcs-corp.com
 

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Charlie Rubeor
Sent: Friday, September 14, 2007 7:41 AM
To: [email protected]
Subject: Re: [U2] [UD] create file

A lot more lines of code, but this should work.  (Please double-check for
typos.)

FILE.IS.OPEN = 0
LOOP
        OPENSEQ '/path/file' TO FV
        ON ERROR
                PRINT;PRINT 'Could not open the /path/file file, status
':STATUS():'.'
                STOP
        END LOCKED
                PRINT;PRINT 'File /path/file is locked.'
                SLEEP 1
        END THEN
                FILE.IS.OPEN = 1
        END ELSE
                CMD = '!touch /path/file'
                EXECUTE CMD CAPTURING OUTPUT RETURNING ERROR.MESSAGE
                IF @SYSTEM.RETURN.CODE = -1 THEN
                        PRINT;PRINT 'Could not create the /path/file file,
status ':STATUS():'.'
                        STOP
                END
        END
UNTIL FILE.IS.OPEN DO REPEAT


[EMAIL PROTECTED] wrote on 09/13/2007 09:44:15 PM:

> Hello group, I am a UV guy and I need some UD assistance.
> 
> In UV I can
> 
> OPENSEQ "/path/file" TO FV ELSE
>   CREATE FV ELSE STOPM "nope"
> END
> 
> Which will create the file if it doesn't exit, after which I can 
> READEQ
or
> READBLK to my heart's content.
> 
> But UD dies at the CREATE statment.
> 
> Also, instead of READBLK WRITEBLK it is OSBREAD, OSBWRITE in UD, 
> correct
?
> 
> Thanks,
> /Scott Ballinger
> Pareto Corporation
> Edmonds WA USA
> 206 713 6006
> -------
> u2-users mailing list
> [email protected]
> To unsubscribe please visit http://listserver.u2ug.org/
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to