dbTalk Databases Forums  

%open etc

comp.databases.pick comp.databases.pick


Discuss %open etc in the comp.databases.pick forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
michael@preece.net
 
Posts: n/a

Default %open etc - 11-08-2005 , 08:01 PM






Where do I look to find out how to use %open etc. on D3 on XP Pro? I
have an old copy of the PSRM which mentions fflgs and eflgs - but I
need more info (like what they mean, what I should set them to, etc.).

Mike.


Reply With Quote
  #2  
Old   
Ross Ferris
 
Posts: n/a

Default Re: %open etc - 11-08-2005 , 08:06 PM






Quote:
From REF
basic.%open
Command basic.%open C Function/BASIC Program
Applicable release versions: AP/Unix
Category BASIC Program (486)
Description opens the Unix file specified by "string" and sets the file
status flags according to the value of "oflag".

Files opened by %open() are closed automatically when the Pick/BASIC
programs terminates.

Valid values of "oflag" are defined in the include fcntl.h.
Combinations of the modes are obtained by adding several flags together
from the following list:

O$RDONLY Opens for reading only.

O$WRONLY Opens for writing only.

O$RDWR Opens for reading and writing.

O$NDELAY Non blocking I/O. The effect of this flag varies depending on
the type of the file. See the Unix Programmer's Reference Manual.

O$APPEND Moves the file pointer to the end of the file.

O$SYNC Sync writes.

O$CREAT If the file exists, this flag has no effect. Otherwise, owner
ID and group ID are set and the mode of the file is set according to
the value of mode modified as follows: all bits in the file mode
creation mask of the process are cleared and the sticky bit is cleared.

O$TRUNC If the file exists, its length is set 0.

O$EXCL If O$EXCL and O$CREAT are set, open will fail if the file
exists.

The file descriptor is returned as a number or "-1" if an error
occurred. System(0) contains the error number.
Syntax file.descriptor=%open(string, oflag {, mode })
Options
Example include dm,bp,unix.h fcntl.h
fd=%open( '/usr/pick/fname', O$WRONLY+O$APPEND )
if fd<0 then
crt &apos;Cannot open. errno=&apos;:system(0)
end


Apart from that, a 'search' of dm,bp, gives around 30 programs you
could look at



Reply With Quote
  #3  
Old   
michael@preece.net
 
Posts: n/a

Default Re: %open etc - 11-08-2005 , 10:12 PM



Thanks Ross - but I think that only applies to *nix and I'm working on
XP Pro on my PC at home. The old version of PSRM gave both the *nix and
DOS versions, while the latest version of PSRM seems to apply only to
*nix, and the DOS version had 3 arguments (or parameters) (something
like "Syntax file.descriptor=%open(string, fflgs, eflgs)" - from memory
- as opposed to the 2 (+mode) for the *nix version. I couldn't find any
details on the fflgs & eflgs.

Cheers
Mike.


Ross Ferris wrote:

Quote:
From REF

basic.%open
Command basic.%open C Function/BASIC Program
Applicable release versions: AP/Unix
Category BASIC Program (486)
Description opens the Unix file specified by "string" and sets the file
status flags according to the value of "oflag".

Files opened by %open() are closed automatically when the Pick/BASIC
programs terminates.

Valid values of "oflag" are defined in the include fcntl.h.
Combinations of the modes are obtained by adding several flags together
from the following list:

O$RDONLY Opens for reading only.

O$WRONLY Opens for writing only.

O$RDWR Opens for reading and writing.

O$NDELAY Non blocking I/O. The effect of this flag varies depending on
the type of the file. See the Unix Programmer&apos;s Reference Manual.

O$APPEND Moves the file pointer to the end of the file.

O$SYNC Sync writes.

O$CREAT If the file exists, this flag has no effect. Otherwise, owner
ID and group ID are set and the mode of the file is set according to
the value of mode modified as follows: all bits in the file mode
creation mask of the process are cleared and the sticky bit is cleared.

O$TRUNC If the file exists, its length is set 0.

O$EXCL If O$EXCL and O$CREAT are set, open will fail if the file
exists.

The file descriptor is returned as a number or "-1" if an error
occurred. System(0) contains the error number.
Syntax file.descriptor=%open(string, oflag {, mode })
Options
Example include dm,bp,unix.h fcntl.h
fd=%open( &apos;/usr/pick/fname&apos;, O$WRONLY+O$APPEND )
if fd<0 then
crt &apos;Cannot open. errno=&apos;:system(0)
end


Apart from that, a 'search' of dm,bp, gives around 30 programs you
could look at


Reply With Quote
  #4  
Old   
Mark Brown
 
Posts: n/a

Default Re: %open etc - 11-08-2005 , 11:14 PM



It works the same on NT. Just substitute DOS for *nix.

There's a file to include depending on exactly what you're doing,
dm,bp,includes

Check out D3Ref account, D3.DOC for A0 = BASIC.%]

Unless you are dealing with binary items or incredibly large items, you
might be better off just opening the file via OSFI.

Mark Brown


<michael (AT) preece (DOT) net> wrote

Quote:
Thanks Ross - but I think that only applies to *nix and I'm working on
XP Pro on my PC at home. The old version of PSRM gave both the *nix and
DOS versions, while the latest version of PSRM seems to apply only to
*nix, and the DOS version had 3 arguments (or parameters) (something
like "Syntax file.descriptor=%open(string, fflgs, eflgs)" - from memory
- as opposed to the 2 (+mode) for the *nix version. I couldn't find any
details on the fflgs & eflgs.

Cheers
Mike.


Ross Ferris wrote:

From REF

basic.%open
Command basic.%open C Function/BASIC Program
Applicable release versions: AP/Unix
Category BASIC Program (486)
Description opens the Unix file specified by "string" and sets the file
status flags according to the value of "oflag".

Files opened by %open() are closed automatically when the Pick/BASIC
programs terminates.

Valid values of "oflag" are defined in the include fcntl.h.
Combinations of the modes are obtained by adding several flags together
from the following list:

O$RDONLY Opens for reading only.

O$WRONLY Opens for writing only.

O$RDWR Opens for reading and writing.

O$NDELAY Non blocking I/O. The effect of this flag varies depending on
the type of the file. See the Unix Programmer&apos;s Reference Manual.

O$APPEND Moves the file pointer to the end of the file.

O$SYNC Sync writes.

O$CREAT If the file exists, this flag has no effect. Otherwise, owner
ID and group ID are set and the mode of the file is set according to
the value of mode modified as follows: all bits in the file mode
creation mask of the process are cleared and the sticky bit is cleared.

O$TRUNC If the file exists, its length is set 0.

O$EXCL If O$EXCL and O$CREAT are set, open will fail if the file
exists.

The file descriptor is returned as a number or "-1" if an error
occurred. System(0) contains the error number.
Syntax file.descriptor=%open(string, oflag {, mode })
Options
Example include dm,bp,unix.h fcntl.h
fd=%open( &apos;/usr/pick/fname&apos;, O$WRONLY+O$APPEND )
if fd<0 then
crt &apos;Cannot open. errno=&apos;:system(0)
end


Apart from that, a 'search' of dm,bp, gives around 30 programs you
could look at




Reply With Quote
  #5  
Old   
michael@preece.net
 
Posts: n/a

Default Re: %open etc - 11-08-2005 , 11:29 PM




Mark Brown wrote:
Quote:
It works the same on NT. Just substitute DOS for *nix.

What was that stuff I read about eflgs and fflgs then? I *know* I
wasn't dreaming.

Quote:
There's a file to include depending on exactly what you're doing,
dm,bp,includes

Check out D3Ref account, D3.DOC for A0 = BASIC.%]

Unless you are dealing with binary items or incredibly large items, you
might be better off just opening the file via OSFI.

Mark Brown

After a long break I'm finally back to working on my framework. Last
time I got stuck on trying to figure out why there was such a delay
between one process writing an item to a file and another process
noticing it was there. I thought maybe a direct %open/%write/%close
from one process and %open/loop/%read then exit/repeat/%close on the
other process might be the answer. No need for the monitor (or
whatever) to be involved in any *extra* logic that might apply to Pick
files or OSFI. All I want is to send some data to another process - the
data doesn't need to persist at all.

Mike.

Quote:
michael (AT) preece (DOT) net> wrote in message
news:1131509570.306834.214380 (AT) z14g2000cwz (DOT) googlegroups.com...
Thanks Ross - but I think that only applies to *nix and I'm working on
XP Pro on my PC at home. The old version of PSRM gave both the *nix and
DOS versions, while the latest version of PSRM seems to apply only to
*nix, and the DOS version had 3 arguments (or parameters) (something
like "Syntax file.descriptor=%open(string, fflgs, eflgs)" - from memory
- as opposed to the 2 (+mode) for the *nix version. I couldn't find any
details on the fflgs & eflgs.

Cheers
Mike.


Ross Ferris wrote:

From REF

basic.%open
Command basic.%open C Function/BASIC Program
Applicable release versions: AP/Unix
Category BASIC Program (486)
Description opens the Unix file specified by "string" and sets the file
status flags according to the value of "oflag".

Files opened by %open() are closed automatically when the Pick/BASIC
programs terminates.

Valid values of "oflag" are defined in the include fcntl.h.
Combinations of the modes are obtained by adding several flags together
from the following list:

O$RDONLY Opens for reading only.

O$WRONLY Opens for writing only.

O$RDWR Opens for reading and writing.

O$NDELAY Non blocking I/O. The effect of this flag varies depending on
the type of the file. See the Unix Programmer&apos;s Reference Manual.

O$APPEND Moves the file pointer to the end of the file.

O$SYNC Sync writes.

O$CREAT If the file exists, this flag has no effect. Otherwise, owner
ID and group ID are set and the mode of the file is set according to
the value of mode modified as follows: all bits in the file mode
creation mask of the process are cleared and the sticky bit is cleared.

O$TRUNC If the file exists, its length is set 0.

O$EXCL If O$EXCL and O$CREAT are set, open will fail if the file
exists.

The file descriptor is returned as a number or "-1" if an error
occurred. System(0) contains the error number.
Syntax file.descriptor=%open(string, oflag {, mode })
Options
Example include dm,bp,unix.h fcntl.h
fd=%open( &apos;/usr/pick/fname&apos;, O$WRONLY+O$APPEND )
if fd<0 then
crt &apos;Cannot open. errno=&apos;:system(0)
end


Apart from that, a 'search' of dm,bp, gives around 30 programs you
could look at



Reply With Quote
  #6  
Old   
michael@preece.net
 
Posts: n/a

Default Re: %open etc - 11-09-2005 , 12:14 AM



This relates to the thread : Communicating with phantoms.

For full background see the *entire* message at
http://groups.google.com.au/group/co...6?dmode=source

Mike.


Reply With Quote
  #7  
Old   
Peter McMurray
 
Posts: n/a

Default Re: %open etc - 11-09-2005 , 12:25 AM



Hi
Somebody had a brainstorm and combined the NT and Unix versions. Just to
make it more interesting they did not change the Unix name nor did they tell
anybody.
You need
INCLUDE DM,BP,UNIX.H FCNTL.H;* Yes this does apply to NT
and you need to use COMPILE ITEM (C)
Peter McMurray
<michael (AT) preece (DOT) net> wrote

Quote:
Thanks Ross - but I think that only applies to *nix and I'm working on
XP Pro on my PC at home. The old version of PSRM gave both the *nix and
DOS versions, while the latest version of PSRM seems to apply only to
*nix, and the DOS version had 3 arguments (or parameters) (something
like "Syntax file.descriptor=%open(string, fflgs, eflgs)" - from memory
- as opposed to the 2 (+mode) for the *nix version. I couldn't find any
details on the fflgs & eflgs.

Cheers
Mike.


Ross Ferris wrote:

From REF

basic.%open
Command basic.%open C Function/BASIC Program
Applicable release versions: AP/Unix
Category BASIC Program (486)
Description opens the Unix file specified by "string" and sets the file
status flags according to the value of "oflag".

Files opened by %open() are closed automatically when the Pick/BASIC
programs terminates.

Valid values of "oflag" are defined in the include fcntl.h.
Combinations of the modes are obtained by adding several flags together
from the following list:

O$RDONLY Opens for reading only.

O$WRONLY Opens for writing only.

O$RDWR Opens for reading and writing.

O$NDELAY Non blocking I/O. The effect of this flag varies depending on
the type of the file. See the Unix Programmer&apos;s Reference Manual.

O$APPEND Moves the file pointer to the end of the file.

O$SYNC Sync writes.

O$CREAT If the file exists, this flag has no effect. Otherwise, owner
ID and group ID are set and the mode of the file is set according to
the value of mode modified as follows: all bits in the file mode
creation mask of the process are cleared and the sticky bit is cleared.

O$TRUNC If the file exists, its length is set 0.

O$EXCL If O$EXCL and O$CREAT are set, open will fail if the file
exists.

The file descriptor is returned as a number or "-1" if an error
occurred. System(0) contains the error number.
Syntax file.descriptor=%open(string, oflag {, mode })
Options
Example include dm,bp,unix.h fcntl.h
fd=%open( &apos;/usr/pick/fname&apos;, O$WRONLY+O$APPEND )
if fd<0 then
crt &apos;Cannot open. errno=&apos;:system(0)
end


Apart from that, a 'search' of dm,bp, gives around 30 programs you
could look at




Reply With Quote
  #8  
Old   
michael@preece.net
 
Posts: n/a

Default Re: %open etc - 11-09-2005 , 04:02 PM



Ahh.. Thanks Pete. Makes sense now.

Cheers
Mike.


Reply With Quote
  #9  
Old   
Tony Gravagno
 
Posts: n/a

Default Re: %open etc - 11-10-2005 , 05:46 PM



Peter, I believe you mean use the "O" option to flash-compile, not the
C option which removes extra bytes from the object code.

Mike, if you want interprocess comms, good luck bud. I wish we could
malloc memory, carve it up into logical segments, then make various
segments available for other processes to peek/poke the same way. If
someone knows a way to do this that's cross-platform compatible and
doesn't require linking new C code into the D3 monitor, please let me
know - just show me where the fish are, I don't need a fish.

According to RD those %functions are just transparent pass-through's
to their host OS C counterparts, so if you look up the functions in
other development areas on the net you will find the info you need.
Some info won't be easy to find, I warn you, but it's out there. Glen
and I can both attest, however, that there are some funky aspects of
the %functions that most definitely don't behave as expected. As you
know, some functions are Unix or NT only, and there are a couple that
have different commands (not just arguments) depending on the
platform. Final tidbit, when a parameter requires a numeric field,
remember that this is a C typed numeric and not a generic MV untyped
variable. To coerce variables into numeric you might need to add zero
to them. As in:
result = %function(iamastring+0)
HTH
T

"Peter McMurray" <excalibur21 (AT) bigpond (DOT) com> wrote:

Quote:
Hi
Somebody had a brainstorm and combined the NT and Unix versions. Just to
make it more interesting they did not change the Unix name nor did they tell
anybody.
You need
INCLUDE DM,BP,UNIX.H FCNTL.H;* Yes this does apply to NT
and you need to use COMPILE ITEM (C)
Peter McMurray
michael (AT) preece (DOT) net> wrote in message
news:1131509570.306834.214380 (AT) z14g2000cwz (DOT) googlegroups.com...
Thanks Ross - but I think that only applies to *nix and I'm working on
XP Pro on my PC at home. The old version of PSRM gave both the *nix and
DOS versions, while the latest version of PSRM seems to apply only to
*nix, and the DOS version had 3 arguments (or parameters) (something
like "Syntax file.descriptor=%open(string, fflgs, eflgs)" - from memory
- as opposed to the 2 (+mode) for the *nix version. I couldn't find any
details on the fflgs & eflgs.

Cheers
Mike.


Ross Ferris wrote:

From REF

basic.%open
Command basic.%open C Function/BASIC Program
Applicable release versions: AP/Unix
Category BASIC Program (486)
Description opens the Unix file specified by "string" and sets the file
status flags according to the value of "oflag".

Files opened by %open() are closed automatically when the Pick/BASIC
programs terminates.

Valid values of "oflag" are defined in the include fcntl.h.
Combinations of the modes are obtained by adding several flags together
from the following list:

O$RDONLY Opens for reading only.

O$WRONLY Opens for writing only.

O$RDWR Opens for reading and writing.

O$NDELAY Non blocking I/O. The effect of this flag varies depending on
the type of the file. See the Unix Programmer&apos;s Reference Manual.

O$APPEND Moves the file pointer to the end of the file.

O$SYNC Sync writes.

O$CREAT If the file exists, this flag has no effect. Otherwise, owner
ID and group ID are set and the mode of the file is set according to
the value of mode modified as follows: all bits in the file mode
creation mask of the process are cleared and the sticky bit is cleared.

O$TRUNC If the file exists, its length is set 0.

O$EXCL If O$EXCL and O$CREAT are set, open will fail if the file
exists.

The file descriptor is returned as a number or "-1" if an error
occurred. System(0) contains the error number.
Syntax file.descriptor=%open(string, oflag {, mode })
Options
Example include dm,bp,unix.h fcntl.h
fd=%open( &apos;/usr/pick/fname&apos;, O$WRONLY+O$APPEND )
if fd<0 then
crt &apos;Cannot open. errno=&apos;:system(0)
end


Apart from that, a 'search' of dm,bp, gives around 30 programs you
could look at




Reply With Quote
  #10  
Old   
Peter McMurray
 
Posts: n/a

Default Re: %open etc - 11-10-2005 , 10:56 PM



Hi Tony
Thanks for the tip about typing variables. I have never used these things
in production only for some testing.
As for the Compile (O) sorry it is the tomato season and my body aches from
manual labour so the brain shuts down. Compile (C) is of course used by
anybody who never makes mistakes. I would love to meet one. There was also
a wonderful BASIC (S) option that suppressed errors in Microdata days, known
as the Sue Me option.
Peter McMurray
"Tony Gravagno" <g6q3x9lu53001 (AT) sneakemail (DOT) com.invalid> wrote

Quote:
Peter, I believe you mean use the "O" option to flash-compile, not the
C option which removes extra bytes from the object code.

Mike, if you want interprocess comms, good luck bud. I wish we could
malloc memory, carve it up into logical segments, then make various
segments available for other processes to peek/poke the same way. If
someone knows a way to do this that's cross-platform compatible and
doesn't require linking new C code into the D3 monitor, please let me
know - just show me where the fish are, I don't need a fish.

According to RD those %functions are just transparent pass-through's
to their host OS C counterparts, so if you look up the functions in
other development areas on the net you will find the info you need.
Some info won't be easy to find, I warn you, but it's out there. Glen
and I can both attest, however, that there are some funky aspects of
the %functions that most definitely don't behave as expected. As you
know, some functions are Unix or NT only, and there are a couple that
have different commands (not just arguments) depending on the
platform. Final tidbit, when a parameter requires a numeric field,
remember that this is a C typed numeric and not a generic MV untyped
variable. To coerce variables into numeric you might need to add zero
to them. As in:
result = %function(iamastring+0)
HTH
T

"Peter McMurray" <excalibur21 (AT) bigpond (DOT) com> wrote:

Hi
Somebody had a brainstorm and combined the NT and Unix versions. Just to
make it more interesting they did not change the Unix name nor did they
tell
anybody.
You need
INCLUDE DM,BP,UNIX.H FCNTL.H;* Yes this does apply to NT
and you need to use COMPILE ITEM (C)
Peter McMurray
michael (AT) preece (DOT) net> wrote in message
news:1131509570.306834.214380 (AT) z14g2000cwz (DOT) googlegroups.com...
Thanks Ross - but I think that only applies to *nix and I'm working on
XP Pro on my PC at home. The old version of PSRM gave both the *nix and
DOS versions, while the latest version of PSRM seems to apply only to
*nix, and the DOS version had 3 arguments (or parameters) (something
like "Syntax file.descriptor=%open(string, fflgs, eflgs)" - from memory
- as opposed to the 2 (+mode) for the *nix version. I couldn't find any
details on the fflgs & eflgs.

Cheers
Mike.


Ross Ferris wrote:

From REF

basic.%open
Command basic.%open C Function/BASIC Program
Applicable release versions: AP/Unix
Category BASIC Program (486)
Description opens the Unix file specified by "string" and sets the file
status flags according to the value of "oflag".

Files opened by %open() are closed automatically when the Pick/BASIC
programs terminates.

Valid values of "oflag" are defined in the include fcntl.h.
Combinations of the modes are obtained by adding several flags together
from the following list:

O$RDONLY Opens for reading only.

O$WRONLY Opens for writing only.

O$RDWR Opens for reading and writing.

O$NDELAY Non blocking I/O. The effect of this flag varies depending on
the type of the file. See the Unix Programmer&apos;s Reference Manual.

O$APPEND Moves the file pointer to the end of the file.

O$SYNC Sync writes.

O$CREAT If the file exists, this flag has no effect. Otherwise, owner
ID and group ID are set and the mode of the file is set according to
the value of mode modified as follows: all bits in the file mode
creation mask of the process are cleared and the sticky bit is cleared.

O$TRUNC If the file exists, its length is set 0.

O$EXCL If O$EXCL and O$CREAT are set, open will fail if the file
exists.

The file descriptor is returned as a number or "-1" if an error
occurred. System(0) contains the error number.
Syntax file.descriptor=%open(string, oflag {, mode })
Options
Example include dm,bp,unix.h fcntl.h
fd=%open( &apos;/usr/pick/fname&apos;, O$WRONLY+O$APPEND )
if fd<0 then
crt &apos;Cannot open. errno=&apos;:system(0)
end


Apart from that, a 'search' of dm,bp, gives around 30 programs you
could look at






Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.