Jump to content

Sys2Open: Difference between revisions

From EDM2
Ak120 (talk | contribs)
mNo edit summary
Ak120 (talk | contribs)
mNo edit summary
 
Line 2: Line 2:


==Arguments==
==Arguments==
REXX ARGUMENTS:
# Name of file or stream to open. (REQUIRED)
# Name of file or stream to open. (REQUIRED)
# Open action flags, must be either "O" (open if exists), "R" (replace if exists), or nothing (fail if exists), optionally followed by "C" (create if file does not exist). If "C" is not specified, the operation will fail if the file does not exist. Note that a value of "" alone will therefore fail automatically. (DEFAULT: "O")<br/>In summary, the possible combinations are:
# Open action flags, must be either "O" (open if exists), "R" (replace if exists), or nothing (fail if exists), optionally followed by "C" (create if file does not exist). If "C" is not specified, the operation will fail if the file does not exist. Note that a value of "" alone will therefore fail automatically. (DEFAULT: "O")<br/>In summary, the possible combinations are:
Line 42: Line 41:


==Return Value==
==Return Value==
REXX RETURN VALUE: File handle, or "" in case of error.
File handle, or "" in case of error.


[[Category:RxUtilEx]]
[[Category:RxUtilEx]]

Latest revision as of 06:39, 3 May 2020

Opens a file or other stream; files larger than 2GB are supported (this function is a wrapper to DosOpenL). Direct-DASD mode is not supported by this function, nor is setting the initial extended attributes.

Arguments

  1. Name of file or stream to open. (REQUIRED)
  2. Open action flags, must be either "O" (open if exists), "R" (replace if exists), or nothing (fail if exists), optionally followed by "C" (create if file does not exist). If "C" is not specified, the operation will fail if the file does not exist. Note that a value of "" alone will therefore fail automatically. (DEFAULT: "O")
    In summary, the possible combinations are:
    O = Open only (if file exists, open it; if not, fail)
    OC= Open/create (if file exists, open it; if not, create it)
    R = Replace only (if file exists, replace it; if not, fail)
    RC= Replace/create (if file exists, replace it; if not, create it)
    C = Create only (if file exists, fail; if not, create it)
    (empty) = No-op (if file exists, fail; if not, fail)
  3. Access mode flags, one or both of: (DEFAULT: "RW")
    R = Open file with read access.
    W = Open file with write access.
  4. Sharing mode flags, any combination of: (DEFAULT: "W")
    R = Deny read access to other processes
    W = Deny write access to other processes
  5. Deny legacy DosOpen access, one of:
    0 = Allow DosOpen to access the file (DEFAULT)
    1 = Deny access using the DosOpen API
  6. Privacy/inheritance flag, one of:
    0 = The file handle is inherited by child processes. (DEFAULT)
    1 = The file handle is private to the current process.
  7. Initial file attributes when creating a file: (DEFAULT: "")
    A = Archive attribute set
    D = Directory attribute set
    S = System attribute set
    H = Hidden attribute set
    R = Read-only attribute set
  8. Initial file size when creating or replacing a file; ignored if access mode is read-only. (DEFAULT: 0)
  9. I/O mode flags, any or all of: (DEFAULT: "")
    T = Write-through mode (default is normal write)
    N = No-cache mode (default is to use filesystem cache)
    S = Sequential access
    R = Random access
    * S and R can combine as follows:
    Neither: No locality known (default)
    S only: Mainly sequential access
    R only: Mainly random access
    Both: Random/sequential (i.e. random with some locality)

Return Value

File handle, or "" in case of error.