Previous Topic: HPLOT Command—Produce a Horizontal PlotNext Topic: INCLUDE Command-Define Time Ranges


IF Command—Assign Identifier Values

The IF command lets you assign new values to identifiers or create new identifiers based on existing identifiers.

This command has the following syntax:

IF idoption1=(identifier[,identifier,identifier...])
THEN idoption2=newvalue [ELSE idoption3=newvalue]
idoption1

Specifies the ID option whose value is being tested.

identifier

Specifies an ID option or one or more identifiers to compare to idoption1.

idoption2

Specifies the ID option whose identifiers are assigned a new value when the IF clause is true. This value can be the same as idoption1.

newvalue

Defines the new value to assign to the identifier. Replace newvalue with either an ID option or a character string. If you specify a character string, enclose it in single quotes.

idoption3

Specifies the ID option whose identifiers are assigned a new value when the IF clause is false. This value can be the same as idoption2.

Examples: IF Command

The following command replaces the value of TERMID with the value of TRANID whenever the value of TERMID is equal to L*:

IF TERMID=(L*) THEN TERMID=TRANID

The following command replaces the value of TRANID with the character string production whenever the value of TRANID begins with P:

IF TRANID=(P*) THEN TRANID='production' ELSE TRANID='test'

The following command creates the ID option DEPARTMENT. Whenever the value of TRANID begins with P, DEPARTMENT is assigned the value production.

IF TRANID=(P*) THEN DEPARTMENT='production'