|
Special FunctionsThis section describes the special functions included in QCL which have no direct FORTRAN 77 counterpart. SUBThe function SUB is used to extract a sub-string and is equivalent to <name>(<i>:<j>). SUB(<string>,<i>,<j>) The <name>(<i>:<j>) form can be used if the <string> has been assigned a name but the SUB() form must be used if the string is just the intermediate result of the resolution of an expression. The form <name>(<i>:) cannot be used, there must be a second argument. The LEN function or zero can be used if the length is unknown. A=SUB(3*4,1,6) B=C(1:LEN(C)) B=C(1:0) FMTThe function FMT is used to control the format of the results of numerical calculations. FMT(<string>,<form>) <string> is a numeric literal or name assigned to a numeric literal; <form> is a format specification string (e.g. F10.3). A=FMT(3*C+4,'I3') UPCThe function UPC converts the argument string to upper case.
qcl>A=UPC('a string')
qcl>. A
A STRING
OLD, NEW and READOLD, NEW and READ are I/O functions. <channel>=OLD(<filename>) Opens the existing file and returns a channel number to be used subsequently. <channel>=NEW(<filename>) Opens a new file and returns a channel number. <line>=READ(<channel>) Reads a line from the specified channel. Channel 5 is assigned to system output so LINE=READ(5) reads a line from the terminal. SYMBOLSYMBOL replaces the argument by the symbol assigned to the argument rather then the string assigned to the argument. This is useful if a symbol is assigned to another symbol which is required on the left hand side of an assignment statement. qcl>PARAMETER='JOKE' qcl>SYMBOL(PARAMETER)='Hello and welcome' The string "Hello and welcome" is now assigned to JOKE, not PARAMETER. INSA, INSB, DEL and REPFour string editing functions have been included in QCL. INSA(<str1>,<str2>,<str3>) Insert <str1> into <str2> after <str3>. INSB(<str1>,<str2>,<str3>) Insert <str1> into <str2> before <str3>. REP(<str1>,<str2>,<str3>) Replace <str1> by <str2> in <str3>. DEL(<str1>,<str2>) Delete <str1> from <str2>. Note that the order of arguments is derived from the natural description of the functions. [Top of page] [Next: Assignment to a Channel] [Previous: Character Relational Operators] [Back to Assignments and Expressions] |
|||||||||||||||||||||||||||||||||||
|
|