Processing Character Data
Developing TACL Programs
2–16
107365 Tandem Computers Incorporated
Additional Data
Manipulation Capabilities
Use the built-in functions and commands in Table 2-3 to perform other data
manipulation tasks. A dash indicates that there is no equivalent function or command.
Table 2-3. Data Manipulation Functions
Function
Command
Description
#APPEND
—
Adds a line of text to a variable level.
#APPENDV
—
Appends a string or the contents of a variable level to the
end of another variable level.
#COMPAREV
_COMPAREV
Compares one string or variable level with another.
—
COPYVAR
Copies the contents of one variable level to another.
#EMPTY
—
Determines whether specified text is empty.
#EMPTYV
—
Determines whether a variable level or quoted text is
empty.
#EXTRACT
—
Obtains the first line of a variable level.
#EXTRACTV
—
Moves the first line of a variable level to another variable
level.
—
FILETOVAR
Copies data from a file to the end of a variable level.
—
JOIN
Converts a multiple-line variable level into a single-line
variable level with spaces in place of end-of-line indicators.
—
_LONGEST
Returns the longest element in a variable containing a
space-separated list.
#SET
SET VARIABLE
Changes the entire contents of a variable level.
#SETMANY
—
Distributes the members of a space-separated list into
individual variable levels.
#SETV
—
Copies a string or variable level into another variable level.
—
VARTOFILE
Copies data from a variable level to a file.
To read data into a variable from a sequential file, you can use either FILETOVAR or
#SET. The following statements move the contents of
filename
into
variable
:
FILETOVAR
filename variable
or
#SET /IN
filename/ variable
The #SET command is much faster and is easier to debug: FILETOVAR is
implemented as a looping macro; #SET uses TAL code. The maximum record length
for records in files copied by FILETOVAR is 239 characters. When using #SET, make
sure #INFORMAT is set to PLAIN.