Previous Topic: Substituting Keywords in Control StatementsNext Topic: Nested Keyword Substitution


Examples

Example 1

Given Model Control Statements:

@   MYWORD  = 'ABCDE'   ;  NEWWORD = '<MYWORD>1'
@   MYWORD  = 'EFGHI'   ;  NEWWORD = '<MYWORD>1'

The model is processed as if the following statements had been entered:

@   MYWORD  = 'ABCDE'   ;  NEWWORD = 'ABCDE1'
@   MYWORD  = 'EFGHI'   ;  NEWWORD = 'EFGHI1'

Example 2

Given Model Control Statements and $LIBCODE=SRCE:

@   $OUTMEM = '<$LIBCODE>B'

Is processed as if it read:

@   $OUTMEM = 'SRCEB'

And for $LIBCODE=LOAD as if it read:

@   $OUTMEM = 'LOADB'

Example 3

You want to generate a name based on characters three through six of the member name supplied in $FROMNAME. The new name must be no more than eight characters, but $FROMNAME can be any length from five to eight characters.

For example, if the value of $FROMNAME is 'ABC123', you want to generate a value of 'XC123YZ'.

The following modeling statement assigns the needed value to USERVAR.

@USERVAR = 'X<$FROMNAME,3,4>YZ'

Example 4

You want to generate a name based on characters three to six of the member name supplied in $FROMNAME. The new name must be no more than eight characters, but $FROMNAME can be any length from one to eight characters.

For example, if the value of $FROMNAME is 'ABC123' you want to generate a value of 'XCYZ'.

This example is very similar to the previous one, except that $FROMNAME can be shorter than the value returned by keyword substitution. In other words, if the value of $FROMNAME is 'ABC', the statement used for Example 3 would generate a value of 'XC   YZ' (note the three embedded blanks).

To eliminate the embedded blanks, you introduce a temporary user keyword, TEMP so that the new name generated is 'XCYZ' (without any blanks).

The following modeling statements assign the needed value to USERVAR.

@ TEMP = '<$FROMNAME,3,4>'
@ USERVAR = 'X<TEMP>YZ'