Kernel 8.0 APIs Banner
Office of Information and Technology (OIT) Banner
[skip navigation]

OPEN^%ZISH(): Open Host File

Reference Type: Supported, Category: Host Files, ICR#: 2320

Description

The OPEN^%ZISH API opens a Host file without using the device handler. You can use the device name returned in IO. You can then READ and WRITE from the opened Host file (depending on what access mode you used to open the file).

To close the Host file, use the CLOSE^%ZISH API with the handle you used to open the file.

Format

  OPEN^%ZISH([handle][,path,]filename,mode[,max][,subtype])

Input Parameters

handle:

(optional) Unique name you supply to identify the opened device.

path:

(optional) Full path, up to but not including the filename. If not supplied, the default HFS directory is used.

filename:

(required) Name of the file to open.

mode:

(required) Mode to open file:

  • W—WRITE

  • R—READ

  • A—APPEND

  • B—BLOCK (fixed record size)
max:

(optional) Maximum record size for a new file.

subtype:

(optional) File subtype.

Output Variables

POP:

Returns the following values:

  • Zero (0)—File was opened successfully.

  • Positive Value—File was not opened.
IO:

Name of the opened file in the format to use for M USE and CLOSE commands.

Example

D OPEN^%ZISH("FILE1","USER$:[ANONYMOUS]","ARCHIVE.DAT","A")
Q:POP
U IO F I=1:1:100 W I,": ",ARRAY(I),!
D CLOSE^%ZISH("FILE1")