Preprocessor interactive

<< Click to Display Table of Contents >>

Navigation:  Command Language > Preprocessor >

Preprocessor interactive

As the preprocessor is run (not in background) the values of an index can be requested from the user using a *ASK command.

There can be any number of *ASK commands in a CL script.

*ASK

This invokes a new window when reached.  There are three forms of the command:

[*ASK index]

[*ASK index = dsindex]

[*ASK(M) dsindexout = dsindex]

The first simply asks for a number from the user. Only integer values can be entered.

The second asks for a single selection from the list of options in the data set dsindex.  If the first is chosen index is set to 1, if the second is chosen it is set to 2, and so on.

The third asks for one or more selections from the list of options in the data set dsindex.  The chosen selections are stored in the new data set dsindexout as zero or one (0 for not chosen, 1 for chosen).  The size of dsindexout will be the same as the size of dsindex. The name used for dsindexout should be a new data set name not used previously.

The first two will set the index to null if the user cancels this.

For example to ask for a value between 0 and 600, with 5 tries to get a valid answer:

[*do Try=1:5]

[*ask ValueWanted]

[*skip 99 null ValueWanted]

[*skip 99 on ValueWanted.lt.0]

[*skip 99 on ValueWanted.gt.600]

[*last Try]

[*99]

[*end Try]

! value input was [ValueWanted]

This example asks the user to choose one of the named continents, with 5 tries to get a valid answer:

[*data MyList=Europe,Asia,Other]

[*do Try=1:5]

[*ask WhichOne=MyList][*skip 99 null WhichOne][*last Try][*99]

[*end Try]

! Chose [MyList.WhichOne]

This example asks for any number selections from the list:

[*data MyList=Europe,Asia,Other]

[*ask(m) dsChosen=MyList]

[*skip 91 on [dsChosen.1].eq.0] !Europe[*91]

[*skip 91 on [dsChosen.2].eq.0] !Asia[*91]

[*skip 91 on [dsChosen.3].eq.0] !Other[*91]