EasyManuals Logo

HP TACL User Manual

HP TACL
235 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #62 background imageLoading...
Page #62 background image
Processing Arguments
Developing TACL Routines
3–6 107365 Tandem Computers Incorporated
The following examples illustrate two ways to retrieve a number from a position
within a line of text (as returned by FUP or other processes). First, you can use the
#CHARGET function:
#PUSH pfree line
#SET line This is a test number: 53
#SET pfree [#CHARGET line 24 FOR 2]
#OUTPUT [pfree]
The preceding code retrieves two characters from line, but does not check that the
two characters are numbers. The number at position 24 must be two characters long;
the code returns two digits even if the number has a single digit or three digits.
As an alternative, you can define a routine that uses #ARGUMENT.
?SECTION getnumber ROUTINE
#FRAME
#PUSH rslt arg position
== First, get the requested character position
#SET rslt [#ARGUMENT /TEXT position/ NUMBER OTHERWISE]
[#CASE [rslt]
|1|
== position is OK
|2|
== Caller did not supply a number for position arg.
#RESULT -1
#RETURN
]
== Skip [position] characters
SINK [#ARGUMENT CHARACTERS /WIDTH [position]/ ]
#SET rslt [#ARGUMENT /TEXT arg/ NUMBER OTHERWISE]
[#CASE [rslt]
|1|
#RESULT 0 [arg]
|2|
== Invalid argument; text at specified position is
== not a number
#RESULT -2
]
#UNFRAME
If getnumber finds a number, it returns a zero followed by the requested number. If
position is invalid, it returns -1; otherwise, it returns -2.

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the HP TACL and is the answer not in the manual?

HP TACL Specifications

General IconGeneral
BrandHP
ModelTACL
CategorySoftware
LanguageEnglish

Related product manuals