Products Downloads


French version


 


ADELIA

VADELIA

SADELIA

WADELIA

EADELIA

(I/B)

(I/B) (C/S)

(S)

(I/B) (C/S)

(B) (C/S)


Warning: In the case of ADELIA programs, this instruction is not compatible with the Adelia iSeries Studio C generator or with Adelia/400.


Section for use

All


Syntax

SWITCH Expression


Description

This instruction opens a SWITCH block.

Expression is the expression that will be evaluated to check which IF_VALUE (or OTHER_VALUE) will be executed.


For ADELIA programs, the expression is either a variable, or a call to a predefined function which can be used in an IF condition.


For programs other than ADELIA, the expression can be an arithmetic or concatenation expression, as well as being a variable or a call to a predefined function (which can be used in an IF condition).


For interactive Visual Adelia programs, the expression can also be a GRAPHIC_OBJECT variable (control, *WINDOW or *MENU_ITEM types).


Example 1

SWITCH  WCODE

IF_VALUE  12  15 25

    WCODE = WCODE * 3

    WTYPE = '1'

IF_VALUE  7  8

    WCODE = WCODE * 2

    WTYPE = '2'

OTHER_VALUE

    WCODE = WCODE + 1

    WTYPE = *BLANK

END_SWITCH


Example 2

* GRAPHIC_OBJECT(ENTRY_FIELD) MyFieldObject */

SWITCH MyFieldObject

IF_VALUE MyWindow.FieldA

...

IF_VALUE MyWindow.FieldA

...

IF_VALUE *NULL_OBJECT

...

OTHER_VALUE

...

END_SWITCH


Example 3

/* GRAPHIC_OBJECT(*WINDOW) MyWindowObject */

SWITCH MyWindowObject

IF_VALUE MyWindowA

...

IF_VALUE MyWindowB

...

IF_VALUE *NULL_OBJECT

...

OTHER_VALUE

...

END_SWITCH


Example 4

/*  GRAPHIC_OBJECT(*MENU_ITEM) MyMenuEltGraphicObject */

SWITCH MyMenuEltGraphicObject

IF_VALUE WIN_NAME[MENU1_NAME]

...

IF_VALUE WIN_NAME[MENU2_NAME]

...

IF_VALUE *NULL_OBJECT

...

OTHER_VALUE

...

END_SWITCH


↑ Top of page

  • Aucune étiquette