The user can declare and use character variables in the same way as INTEGERs and REALs. The default maximum number of character variable is 50, but this can be altered in SATLIT.
Variables are declared by the command CHAR (CHARACter being already reserved PIL word); eg CHAR(CH1,CH2,CH3,CH4).
CHAR variables, which are 68 elements long, are defaulted to a blank line.
Variables are assigned by statements such as:
CH1 = <character expression>.
Permitted character expressions are:
:<character variable>: <character string> or any concatenation of these two.
If, for example, the following PIL instructions are issued:
the following assign the indicated values to CH3 ;
|CH3=CH1||is equivalent to||CH3 = CH1|
|CH3=:CH1:||is equivalent to||CH3 = XXX|
|CH3=CH1:CH1:QQQ:CH2:||is equivalent to||CH3 = CH1XXXQQQXXXZZ|
The values of individual variables can be ascertained by typing the variable name (as with integers and reals). Alternatively, typing SEE C gives the values of all currently-declared character variables
Character-variable names placed between colons have their values substituted for their names. This process is actually carried out at a pre-processing stage and applies to integer and real expressions a well as character-variable names. It therefore has more power than merely allowing string concatenation, as will now be illustrated.
The following two PIL statements are exactly equivalent:
This feature can be used to set real or integer variables from character variables, as shown below:
However, RR=CC would elicit an 'Invalid variable' message.
PIL commands are usually upper-cased and compressed to remove all spaces before processing. This means that unless avoiding action is taken, character strings may not be displayed as expected.
To prevent a character string from being upper-cased and compressed it should be enclosed in quote marks '. Thus whereas
If the string is enclosed in quotes
To display a quote , a double quote must be used, as shown here:
AA='It''s my party'; BB=' and I''ll cry if I want to'
It's my party and I'll cry if I want to
The following character variables are recognised by PIL:
TITLE, NAMFI, NAMGRD, NAMSAT, NAMXYZ, NSAVE, CSG1, CSG2, ..., CSG10.
The following character arrays are recognised by PIL:
CG, NAME, NAMPAT.
See the entry CHAR for declarations of users' own character variables.