Opens an external file for the specified operation. The file argument defines the logical name by which the file will be referenced. The filename is the external name of he file and may include device and directory specifications. The function returns a Boolean value that indicates whether the operation was successful. There is no limit to the number of files that can be open simultaneously, and all open files are closed automatically when the program exits. See also CLOSE(), READ(), and WRITE(). For example:
SAY OPEN(`MyCon', `CON:160/50/320/100/MyCON/cds') P-> 1
SAY OPEN(`outfile', `ram:temp', `W') -> 1
Overlays the new string onto the old string beginning at the specified start position, which must be positive. The default starting position is 1. The new string is truncated or padded to the specified length as required, using the supplied pad character or blanks. If the start position is beyond the end of the old string, the old string is padded on the right. For example:
SAY OVERLAY(`bb', `abcd') -> bbcd
SAY OVERLAY(`4', `123',5,5, `-`) -> 123-4----
Searches for the first occurrence of the pattern argument in the string argument, beginning at the position specified by the start argument. The default starting position is 1. The value is the index of the matched string or 0 if the pattern wasn't found. For example:
SAY POS(`23', `123234') -> 2
SAY POS(`77', `123234') -> 0
SAY POS(`23', `123234',3) -> 4
This function allows a program to change various attributes relating to the system environment within which the program executes. The option argument is a keyword that specifies an environmental attribute. The value argument supplies the new attribute value to be installed. The value returned by the function depends on the attribute selected. Some attributes return the previous value installed, while others may simply set a Boolean success flag.
The currently defined option keywords are:
Specifies a new current directory. The current directory is used as the root for filenames that do not explicitly include a device specification. The return is the old directory name. PRAGMA(`D') is equivalent to PRAGMA(`D',"). It returns the path of the current directory without changing the directory.
Specifies a new task priority. The priority value must be an integer in the range - 128 to 127, but the practical range is much more limited. ARexx programs should never be run at a priority higher than that of the resident process, which currently runs at a priority of 4. The returned value is the previous priority level.
Returns the task ID (the address of the task block) as an 8-character hex string. The task ID is a unique identifier of the particular ARexx invocation and may be used to create a unique name for it.
Specifies a new stack value for your current ARexx program. When a new stack value is declared, the previous stack value is returned.
The currently implemented options are:
PRAGMA(`W',{`NULL'|' WORKBENCH'})
Controls the task's WindowPtr field. Setting it to `NULL' will suppress any requesters that might otherwise be generated by a DOS call.
Defines the specified logical name as the current ("*") console handler, allowing the user to open two streams on one window. If the name is omitted, the console handler is set to that of the client's process.
SAY PRAGMA(`D', `DF0:C') -> Extras
SAY PRAGMA(`D', `DF1:C') -> Workbench:C
SAY PRAGMA(`PRIORITY', -5) -> 0
SAY PRAGMA(`ID') -> 00221ABC
CALL PRAGMA `*',STDOUT
SY PRAGMA("STACK",8092) -> 4000
Returns a pseudo-random integer in the interval specified by the min and max arguments. The default minimum value is 0 and the default maximum value is 999. The interval max-min must be less than or equal to 1000. If a greater range of random integers is required, the values from the RANDU() function can be suitably scaled and translated. The seed argument can be supplied to initialize the internal state of the random number generator. See also RANDU(). For example:
thisroll = RANDOM(1,6) /*Might be 1*/
nextroll = RANDOM(1,6) /*Might be snake eyes*/
Returns a uniformly-distributed, pseudo-random number between 0 and 1. The number of digits of precision in the result is always equal to the current Numeric Digits setting. With the choice of suitable scaling and translation values, RANDU() can be used to generate pseudo-random numbers on an arbitrary interval.
The optional integer seed argument is used to initialize the internal state of the random number generator. See also RANDOM(). For example:
firsttry = RANDU() /*0.371902021?*/
NUMERIC DIGITS 3
tryagain = RANDU () /*0.873?*/
Reads the specified number of characters from the given logical file into a string. The length of the returned string is the actual number of characters read and may be less than the requested length if, for example, the end-of-file was reached. See also READLN(). For example:
Reads characters from the given logical file into a string until a newline character is found. The returned string does not include the newline. See also READCH(). For example:
Removes an entry with the given name from the Library List maintained by the resident process. The Boolean return is 1 if the entry was found and successfully removed. This function does not make a distinction between function libraries and function hosts, but simply removes a named entry. See also ADDLIB(). For example:
SAY REMLIB(`MyLibrary.library') -> 1
Reverses the sequence of characters in the string. For example:
SAY REVERSE(`?ton yhw') -> why not?
Returns the rightmost substring in the given string argument with the specified length. If the substring is shorter than the requested length, it is padded on the left with the supplied pad character or blanks. For example:
SAY RIGHT(`123456',4) -> 3456
SAY RIGHT(`123456',8, `+') -> ++123456
Moves to a new position in the given logical file, specified as an offset from an anchor position. The default anchor is Current. The returned value is the new position relative to the start of the file. For example:
SAY SEEK(`input',10,'B') -> 10
SAY SEEK(`input',0,E') -> 356 /*file length*/
Adds a name-value pair to the Clip List maintained by the resident process. If an entry of the same name already exists, its value is updated to the supplied value string. Entries may be removed by specifying a null value. The function returns a Boolean value that indicates whether the operation was successful. For example:
|