LEDAS  
Leicester Database and Archive Service
 
Mission
    Description
Products
    Databases
Raw Data
    Archive
Analysis Software
    Archive
Ginga Information
Ginga Gallery
Related Sites
Databases
GINGALAC
GINGABGD
GINGAFRF
GINGALOG
GINGAMODE
GINGARAW
View Ginga DBs
Line
Footer
e-mail

Assignments and Expressions

The basic entities manipulated by QCL are character strings. A symbolic <name> is assigned to a character string using assignment statements.

<name> = <expression>

Symbolic names must not contain spaces or tabs but can contain an under-score character. They can also be typed in either upper or lower case. The expression which comprises symbolic names, character, numeric or logical literals and character, numerical or logical functions or operators is resolved and the resulting character string assigned to the symbolic name. Expressions can contain spaces and tabs to separate names and operators etc. An assignment causes the <name> and assigned string to be entered into QCL's dictionary and the use of the <name> in subsequent expressions performs an implicit substitution of that string. The string assigned to a name can be changed by a new assignment statement.

The symbolic names perform a similar function to variable names in FORTRAN77 but they always represent character strings. The way in which a character string is interpreted depends entirely on context and there are no declaration statements in QCL. Expressions in QCL are very similar to FORTRAN77 statements. The operators allowed are as follows, in order of precedence.

 
Character concatenation    //
Logical                    .EQV. .NEQV. .OR. .AND. .NOT.
Character relational       .NT. .IS. .IN. .NI.
Arithmetic relational      .LT. .GT. .EQ. .LE. .GE. .NE.
Arithmetic                 + - * / **

// is used to concatenate strings as shown in the following example

qcl>X=64
qcl>.  'If X='//X//' then SQRT(X)='//SQRT(X)
If X=64.00000000 then SQRT(X)=8.0000000000

The result of an operation is always a character string. The variables can be character, numeric or logical literals.

Character       'a character string'
Numerical       4.5 1200 33.85E-5 -25 +66.5
Logical         .TRUE. Yes .FALSE. No

Expressions are evaluated using the operator precedence given above. If the same operator is used repeatedly then the operations are performed working from left to right. The order in which operations are done can be dictated by using parentheses, just as in FORTRAN77 statements.

The functions supported are

SIN ASIN COS ACOS EXP LOG SQRT LOG10 TAN ATAN ABS INT NINT
MOD SIGN ATAN2 MIN MAX SUB FMT LEN INDEX SECNDS READ OLD NEW 
QCL_CL DATE UPC SYMBOL INSA INSB DEL REP 

They are all followed by parentheses enclosing the arguments required. Upper case characters must be used for all the operators and function names as shown above.

MIN and MAX are only implemented for two arguments, not more as in FORTRAN 77.

Most are the same as in FORTRAN 77 but .NT., .IS., .IN., .NI., SUB, FMT, SECNDS, READ, OLD, NEW, QCL_CL, DATE, UPC and SYMBOL have been invented to suit the QCL environment and are described below.

Parentheses following a <name> which is not a function are assumed to enclose an array index. Only one-dimensional arrays are supported.

 
qcl>J=22
qcl>ARRAY(J)=21
qcl>ARRAY(J+1)=ARRAY(J)+10

More than one assignment can occur on a single command line using commas to separate them.

A=1.3,B=5.5*A,C='THIS IS A STRING',R=FMT(32*A,'F10.5')

The assignments are made from left to right and <names> assigned to the left can be subsequently used on the right. This use of comma is fully compatible with the usual FORTRAN 77 syntax in which comma is used to separate function arguments.



[Top of page] [] [Back to QCL Commands]
 
HOME
SEARCH
SERVICES INFO SOFTWARE ViZieR BLASTA DSS
ARCHIVES ASCA CHANDRA GINGA ROSAT ARNIE