Prev Up Next
Go backward to Createlist command
Go up to Parameter-list generation/extraction commands
Go forward to Loopextract command

Extract command

EXTRACT places valid words from a parameter list into output words to be accessed individually.


EXTRACT <word-parameter-list-name> INTO <parameter-list> [ORDERED|REVERSED]

where <parameter-list> is:

<word> [<word>]r



EXTRACT <group-parameter-list-name>.<item> INTO<parameter-list> [ORDERED|REVERSED]



EXTRACT <group-parameter-list-name> INTO <$-parameter-list>

where <$-parameter-list> is:

<$-word> [<$-word>]r


In the first 2 forms of the command EXTRACT scans the items in <parameter-list-name> and copies only those which are valid in the current event to <parameter list>. In this case the values of the parameters in the input list are copied to the specified words, eg.
EXTRACT  LIST1.E2  INTO  GAMA GAMB GAMC GAMD
copies valid parameter values from the group parameter list LIST1.E2 into the words GAMA, GAMB, etc.

In the third form of the command the group information, denoted using the `$' symbol4 , is retained in the output parameters. The output data must be accessed by specifying the group and an associated item, eg.

EXTRACT LIST1  INTO  $GA $GB
IF $GA.E2 PASSES GARRAY($GA)  {
   IF $GB.E2 PASSES GARRAY($GB)  {
       ...
   }
}
copies the group numbers of valid parameters in group parameter list LIST1 into the group-words $GA and $GB. This group information is then used by the IF...PASSES commands to index into the gate array GARRAY.

If there are fewer valid words than output words they will be placed in the first output words specified in the command. If there are more valid words than available output words then the output words are chosen randomly from the valid words in the input list. EXTRACT can be combined with the arithmetic NUMBER function to obtain the number of words in the parameter list which are present in the event, eg.

EXTRACT  GELIST.E2  INTO  GAMA GAMB GAMC GAMD GAME GAMF
IF NUMBER(GELIST) GT 4 {
    ...
The optional keywords ORDERED (REVERSED) enable the user to specify whether the values of words in the input list are to be output in order of increasing (decreasing) numerical value. If no keyword is specified then the values are output in the order in which they appear in the input list.
support@ns.ph.liv.ac.uk

Prev Up Next