Extract command

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

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,

Example

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 is retained in the output parameters. This is through use of the $ symbol which indicates that the variable references a group-format parameter and does not contain the actual value itself. This means that the group number information, i.e. address, is retained in $-parameters.

The output data must be accessed by specifying the group and an associated item ...

Example

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 (See Arithmetic Functions). to obtain the number of words in the parameter list which are present in the event,

Example

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.