System Functions

VIN( ) / VIS( )

Obtain Value of Variable

Formats

1.

Get Numeric Value:

VIN(string$[,ERR=stmtref])

2.

Get Numeric from Composite:

VIN(composite$,var_1$[[,subscr]]=expr[, ... n])

3.

Get String Value:

VIS(string$[,ERR=stmtref])

4.

Get String from Composite:

VIS(composite$,var_1$[[,subscr]]=expr[, ... n])

5.

VIS( ) as Record Prefix:

REC=VIS(string$[,ERR=stmtref])

Where:

composite$

String variable that has been defined as a composite string.

string

String expression containing the name of a variable to be used.

stmtref

Program line number or statement label to which to transfer control.

[,subscr]

Optional subscript(s) of a variable in the composite string. String expression. You can include from one to three optional numeric expressions in square brackets, comma-separated, as subscripts for the variable.

var_1$ to
var_2$

String expression containing the name of a variable in the composite string.

Note:
You can use the optional ERR=stmtref with each of the syntax formats described. The inner set of brackets enclosing [,subscr] are part of the syntax.

Returns

Contents (value) of variable(s), numeric or string.

Description

The VIN( ) function returns the numeric value (contents) of a variable where the name of the numeric variable is stored in a string variable.

The VIS( ) function returns the string value (contents) of a string variable whose name is stored in a string variable.

Format 1

Get Numeric Value

VIN(string$[,ERR=stmtref])

The VIN( ) function returns the numeric contents of a numeric variable whose variable name is stored in string$.

Format 2

Get Numeric from Composite

VIN(composite$,var_1$[[,subscr]]=expr[, ... n])

The VIN( ) function returns the value contained in each numeric variable you name (where the variable is part of a composite string). You can choose to specify up to three subscripts for the variable.

Format 3

Get String Value

VIS(string$[,ERR=stmtref])

The VIS( ) function returns the contents of a string variable whose variable name is stored in string$.

Format 4

Get String Value from Composite

VIS(composite$,var_1$[[,subscr]]=expr[, ... n])

The VIS( ) function returns the value contained in each string variable you name (where the variable is part of a composite string). You can choose to specify up to three subscripts for the variable.

Format 5

VIS( ) as Record Prefix

REC=VIS(string$[,ERR=stmtref])

Use this format to assign a REC= prefix value dynamically during READ, WRITE, OPEN and other directives. When REC=VIS( ) is used, PxPlus evaluates the string value in VIS( ) and uses it as the name of the record prefix.

Example

0010 print 'CS'
0020 print "Name$,StreetNum,Street$,City$"
0030 Name$="Mike",StreetNum=8920,Street$="Woodbine Ave.",City$="Markham"
0040 input "Select field type (N=Numeric,S=String)",T$
0050 if T$="" then stop
0060 if ucs(T$)<>"S" and ucs(T$)<>"N" then goto 0030
0070 input "What field?",F$
0080 if F$="" then stop
0090 if ucs(T$)="S" then print F$,"=",vis(F$) else print F$,"=",vin(F$)
0100 goto 0030