bdfs1m0oStructured Programming Macros

#CASE Macro Group

Use this macro group to process specific code based on a numeric value, referred to as a case number. The #CASE macro group includes the following macros:

See #CASE Macro Group Processing for a diagram that shows the processing flow of the #CASE macro group.

Format




Notes:

  1. If you specify the MAX parameter, you must also code a #CASE ERROR macro statement.

#CAST reg1
starts a group of #CASE selections, where reg1 is a register that contains the case number. The case number in reg1 is adjusted to index into a branch table generated by the #ECAS macro.

Do not use register 0 for reg1.

POWER=multval
specifies the incremental value between case numbers, where multval is the value. The increment value is 2multval. For example, if you specify POWER=3, the case numbers are multiples of 8. If you do not specify the POWER parameter, the case numbers are generated in increments of 1.

MAX=maxcase
specifies the maximum case number allowed in a group, where maxcase is the maximum number.

If you specify the MAX parameter, you must also code a #CASE ERROR statement.

PREFIX=label
specifies a prefix for all link labels that are generated by this macro group, where label is a 4-character name.

#CASE num
starts a case or group of cases, where num is the case number. The code up to the next #CASE macro or #ECAS macro is processed when reg1 contains the relevant case number.

code1
is the code to process for the specified case or cases.

#CASE ERROR
specifies the start of the code to process for case numbers that are not valid. If you specify the MAX parameter on the #CAST macro, you must also code a #CASE ERROR macro statement.

code2
is the code to process for incorrect case numbers.

#ECAS
ends the selection. This macro generates a branch table entry for each case number specified in a #CASE macro statement. A dummy table entry is generated for each valid but unused case number.

Entry Requirements

None.

Return Conditions

Programming Considerations

Examples

Related Macros

None.