MSM-Workstation
Tutorial (part 5/5)
by
Chris Bonnici
$ZOS reference
$ZOS(1,<drive>)
Sets current drive to the letter specified in <drive>.
Returns 0 if successful, or <errno> to indicate an error.
$ZOS(2,<file>)
Deletes a <file>. <file> may
contain the file path as well. Returns 0 if successful or <errno> if not.
It respects file attributes (eg read-only files cannot be deleted).
$ZOS(3,<oldfn>,<newfn>)
Rename a file called <oldfn> to <newfn>
(eg $ZOS(3,"MWM006.TXT","MWM007.TXT")
$ZOS(3,<oldloc>,<newloc>)
Moves a file called <oldloc> to <newloc>
(eg $ZOS(3,"C:\MWM006.TXT","D:\MWM006.TXT")
One can combine the two characteristics of $ZOS(3) to
perform a move and rename concurrently. Returns 0 if successful or <errno>
if not. It respects file attributes (eg read-only files cannot be moved.)
$ZOS(4)
Returns the Windows version number.
$ZOS(5,<filenm>,<attribute>)
Sets file attributes. <filenm> is the file
whose attributes are to be changed. <attribute> is 32 for archive, 4 for
system, 2 for hidden, and 1 for read-only. Add these up to change more than one property
at a time. Returns null if successful or <errno> if not.
$ZOS(6,<dirname>)
Create a new directory called <dirname>.
Returns null if successful or <errno> if not.
$ZOS(7,<dirname>)
Remove a directory. Returns 0 if successful or <errno>
if not.
$ZOS(8,<dirname>)
Change current directory Returns 0 if successful or <errno>
if not.
$ZOS(10,<filenm>)
Get file attributes. The attributes are 2048 for
compressed, 256 for temporary, 128 for normal (no other attributes), 32 for archive, 16
for directory, 4 for system, 2 for hidden, and 1 for read-only. These values are added
together when more than one attribute exists for a file. If unsuccessful returns <errno>.
$ZOS(11,<drive>)
Get current directory for <drive>. <drive>
is optional and if left out the current drive letter is assumed. Returns the full path of
<errno>.
$ZOS(12,<filenm>,<attribute>)
Commence a directory search for a specified <filenm>
in Windows and is used to find the first file that meets specified search criteria. <attribute>
dictates what files should be looked for and can be 32 for archive, 16 for subdirectory, 8
for volume label, 4 for system, 2 for hidden, 1 for read-only and 0 for ordinary files.
Values can be added together to combine attributes.
<filenm> can take wildcards.
If the function is successful, it returns a string in the
form S1^S2, in which S1 is the FileName that was found and S2 is a character string that
is used as input to the Continue Directory Search function. Otherwise, the function
returns <errno>.
$ZOS(13,<file_search>)
This function continues a directory search that was started
using $ZOS(12). For example
S File=$ZOS(12,"*.*",0)
Q:File<0
W !,$P(File,"^",1)
F S File=$ZOS(13,File) Q:File<0 W !,File
If the function is successful, it returns a string in the
form S1^S2, where S1 is the FileName that was found and S2 is a character string that is
used as the next SearchParm to this function. Otherwise, the function returns <errno>.
$ZOS(14)
Returns the current drive letter or <errno>.
$ZOS(16,<file_search>)
$ZOS(12) and $ZOS(13) take up resources in performing a
directory search. When no (more) files are present this function is automatically called,
but if the search is abandoned this function will release resources dedicated to the
search. This function always returns 0.
$ZOS Function Call Errors
When describing the functions, we used <errno> to
indicate an error situation. Different functions will return different errors, meaning
that not all errors necessarily apply to a particular function. The following table lists
all error codes.
Number |
Description |
-1 |
Invalid function |
-2 |
File not found |
-3 |
Path not found or invalid |
-4 |
Too many open files |
-5 |
Access denied |
-6 |
Handle is invalid |
-8 |
Insufficient memory |
-11 |
Format invalid |
-12 |
Access code invalid |
-14 |
Unknown unit |
-15 |
Disk drive invalid |
-16 |
Attempt to remove the current
directory |
-17 |
Not same device |
-18 |
No more files |
-19 |
Disk write-protected |
-20 |
Unit unknown |
-21 |
Drive not ready |
-23 |
CRC error |
-24 |
Bad request structure length |
-25 |
Seek error |
-26 |
Unknown media type |
-27 |
Sector not found |
-29 |
Write fault |
-30 |
Read fault |
-31 |
General failure |
-32 |
Sharing violation |
-33 |
Lock violation |
-80 |
File already exists |
-82 |
Cannot make directory |
Contact Information |
Chris Bonnici email: chribonn@softhome.net
URL: http://geocities.datacellar.net/SiliconValley/7041
ICQ: 9900205 |
E&OE
|