keyword |
type |
mini sample |
(keyword order is irrelevant) |
Text |
txt |
t=txt |
- txt can be a character constant, or a variable defined by any of the
CHARACTER,
CHAR,
ALIAS,
EDIT-Parse commands
- READ(Text="pi=3.14, i = -123, catch22") a, b, c
! a,b,c numeric. Assigns a=3.14 b=-123 c=22
- READ(Text="pi=3.14, i = -123, catch22") str1, str2
! both
CHARACTER*10: str1="pi=3.14, i" str2=" = -123, c"
- READ(Text="pi=3.14, i = -123, catch22", fmt="F,5X,I5,A") a, b, str1
! assigns: a=3.14 b=-123 str1=", catch22 "
|
FIle |
txt |
fi=name |
- to read a file, the file must be OPENed first. This defines whether the file is:
(the default). Records are separated by
$CRLF or $LF:
- OPEN(FIle=name)
- READ(FIle=name) A
! read next line A in free format: For A numeric the 1st numeric value is assigned, for A character the full line is assigned
- READ(FIle=name) A, B
! read next line A and B: For A numeric the 1st numeric value is assigned, and B is assigned the rest of the line. For A character nothing is left for B: It is assigned either 0 or blank.
- READ(FIle=name, Row=n) text
! to text
_==_: The number of input bytes (RecL) will match the input list
-
OPEN(FIle=nam, UNFormatted, SEQuential)
- READ(FIle=nam, Rec=n) string
! reads LEN(string) bytes starting at byte n
- :
-
OPEN(FIle=nam, RecL=10)
! implies DIRect, address the file in 10-byte fractions:
- READ(FIle=nam, rec= n) str1
! read n-th 10-byte fraction
- : A file that is not suited for direct read because the records have variable lengths, can be read the following way (for more see
OPEN and
MatrixExplorer).
- OPEN(FIle=nam, fmt='6 ,')
! sequential, 6 records per row, separated by blanks
-
DLG(Edit=nam, fmt='6A20')
! opens spreadsheet for edit, column width 20
- str = nam(123, 4)
! assigns element 4 of row 123 of file "nam" to str. A dialog opens on error
- str = nam(123, 0)
! assigns the full row 123 of file "nam" to str. A dialog opens on error
- str = nam(123, 4, *999)
! on error control is transferred to label 999,
⇾ more
- READ(FIle=nam, Row=123, Column=4) str123_4, str123_5
! sequentially read multiple column elements in a row
- READ(FIle=nam, Row=123, Column=0) full_line
! column=0: read full line 123
- to just search a file: see also
SEArch
|
Rec
(with FIle ) |
num |
r=789 |
record number of a file OPENed for UNFormatted SEQuential or DIRect i/o
- OPEN(FIle=name, DIRect, RecL=40)
! open name for direct input/output, needs the record length RecL
- READ(FIle=name, Rec=n) text
! to text
|
ClipBoard |
--- |
cb |
|
Messagebox |
[O] |
m="?a" |
- WRITE(Messagebox=options, IOStat=selected_button) io_list
(
⇾ see details). Program input is by the IOstat option. |
WINdowhandle |
NUM |
win=wh |
Obsolete, use the
DLG function instead. If WIN is missing, input is prompted from the script window.
- READ(Row=2, Column=40, fmt='A40') sample
! this will prompt and read from the
HicEst main window
|
CLoSe |
log |
cls=1 |
closes, cls=-1 truncates file after current position |
|
|
|
|
SEArch |
txt |
sea="??" |
- OPEN(file=nam)
- READ(FIle=nam, search="xyz") string
! search of "xyz" in nam and read containing line into string
- READ(FIle=nam, sea="xyz", Rec=byteNr) string
! byteNr is the
- on input: byteNr is the start byte, on output byteNr>0 is the start position of the search string
- optional: if the search string is prefixed by "C" and ":" : search Case sensitive (e.g. search="case:xyz")
- with a "W" and ":" prefix: search for full Words (e.g. search="Word:xyz")
- see also
matrix file read
- OPEN(FIle=nam, fmt="6 ,")
! 6 blank separated items per row
- row =
INDEX(nam(row1,3), 'xyz')
! search column 3 for xyz starting in row1. The find is in row
-
- row =
INDEX(nam(1,3), 1E10', 32)
! search column 3 for 1E10, option 32 "nearest" finds the maximum (see
INDEX)
|
|
|
|
Formatted READ for all input media |
Format |
txt |
f='F6.2, 2a4' |
⇾ see Format for details |
DecimalPoint |
txt |
dp="," |
default is ".".
- READ(Text="€123,45 $123.45", DecPt=",") euros, dollars, cents
! assigns euros=123.45, dollars=123, cents=45
|
|
|
|
|
IOStat |
NUM |
ios=stat |
get completion code of a READ or get return button number of a READ(Messagebox) |
ItemS |
NUM |
is=count |
- READ(..., ItemS=n) input_list
! n is the number of successfully read items of the input_list
|
LENgth |
NUM |
L=len |
- READ(file=nam, LENgth=L)
!
- Note:
OPEN(file=nam) is not needed
!
|
ERror |
LBL |
err=999 |
on error jump to label |