SLEN [ HP Business BASIC/XL Reference Manual ] MPE/iX 5.0 Documentation
HP Business BASIC/XL Reference Manual
SLEN
The SLEN function returns the string length of the next datum in a file.
If that item is not a string, SLEN returns -1. The result is of type
INTEGER.
Syntax
SLEN(fnum)
Parameters
fnum The file number that HP Business BASIC/XL uses to
identify the file. It is a numeric expression that
evaluates to a positive short integer. Fnum must
specify a BASIC DATA file. An optional # can precede
fnum.
Examples
100 CREATE "File1",FILESIZE=1000 !BDATA file; series of data items.
110 ASSIGN "File1" TO #1
120 POSITION #1; BEGIN !Rewind File1 before writing it.
130 PRINT #1; "abc", 123 !"abc" is item 1, 123 is item 2.
140 POSITION #1; BEGIN !Rewind File1.
150 DISP SLEN(1) !Next item, "abc", is a string;
155 ! return its length, 3.
160 READ #1; A$ !Read item 1.
170 DISP SLEN(1) !Next item, 123, is not a string;
175 ! return -1.
999 END
MPE/iX 5.0 Documentation