Processing Character Data
Developing TACL Programs
2–12
107365 Tandem Computers Incorporated
To find the character position of the first occurrence of the string “text,” starting at
character position 1, enter:
14> #CHARFINDV sample 1 "text"
#CHARFINDV sample 1 "text" expanded to:
62
15>
Use the macro in Figure 2-5,
volname
, to extract a volume name from a variable
named
mylist
. To use this macro, load the file that contains the macro definition and
enter:
volname
When you invoke this macro, it displays the following:
15> volname
The volume name is $DATA
16>
Figure 2-5. Extracting a Volume Name from a Variable
?SECTION volname MACRO
#FRAME
#PUSH mylist begin end vol
== Specify the contents of mylist:
#SET mylist The disk file name is \SYS1.$DATA.SVOL.NAME1.
== Search for a dollar sign:
#SET begin [#CHARFINDV mylist 1 "$"]
== Search for the first period following the dollar sign:
#SET end [#CHARFINDV mylist [begin] "."]
== Retrieve the characters between "$" and ".":
#SET vol [#CHARGET mylist begin TO [#COMPUTE end - 1]]
#OUTPUT The volume name is vol
#UNFRAME
For examples showing the use of these functions for argument processing in routines,
see “Processing Arguments” in Section 3, “Developing TACL Routines.”