There is no CREATE in UD.  OPENSEQ will open the file if it exists or create
it if it doesn't.  If it can't create the file, STATUS() will return a
reason why it can't be created.  In the ELSE branch of the OPENSEQ
statement, if STATUS() = 0, you can proceed to WRITESEQ (or OSBWRITE) to the
file.

Possible STATUS() values:
0 The record does not exist.
1 The file you specify is not a sequential-access file.
2 The file does not exist.
3 The READONLY clause was included in the command statement and the record
does not exist.
4 An unknown error occurred (such as having too many files open or
permission problems).


OPENSEQ '/path/file' TO FV ELSE
   IF STATUS() NE 0 THEN STOP 'UNABLE TO OPEN SEQ FILE'
END 

WRITESEQ "test..." ON FV ELSE STOP "CAN'T WRITE TO SEQ FILE"
WEOFSEQ FV
CLOSESEQ FV

OSBREAD/OSBWRITE is used for block oriented access.  If your file is
line-oriented, you can use READSEQ/WRITESEQ.  You can also use WEOFSEQ to
write an End-of-file marker to the file (and truncates it at that point)
before you close it (CLOSESEQ)

Hope this helps

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


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Scott Ballinger
Sent: Thursday, September 13, 2007 6:44 PM
To: [email protected]
Subject: [U2] [UD] create file

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/

Reply via email to