clist option similar to switch in c language



IBM's Command List programming language & Restructured Extended Executor

clist option similar to switch in c language

Postby var111 » Fri Nov 07, 2008 3:57 pm

Hi All,

Can anybody tell me
Is there any clist parameter equivalent to Switch in c Language, through that we can put multiple conditions???

Thanks in advance.
var111
 
Posts: 4
Joined: Tue Nov 04, 2008 11:31 am
Has thanked: 0 time
Been thanked: 0 time

Re: clist option similar to switch in c language

Postby dick scherrer » Sat Nov 08, 2008 2:51 am

Hello,

If you describe how you would use Switch (or how it operates), maybe someone can offer a rexx equivelent or workaround.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: clist option similar to switch in c language

Postby rajithr007 » Sat Nov 08, 2008 9:55 pm

You can refer SELECT statement in CLIST it also present in REXX
rajithr007
 
Posts: 13
Joined: Thu Sep 11, 2008 11:31 am
Has thanked: 0 time
Been thanked: 0 time

Re: clist option similar to switch in c language

Postby dick scherrer » Sun Nov 09, 2008 12:38 am

Hello,

You can refer SELECT statement in CLIST it also present in REXX
How is this related to "switch" in the "c" programming language?

Clarification would be appreciated.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: clist option similar to switch in c language

Postby rajithr007 » Sun Nov 09, 2008 2:47 am

Hi Dick,
Both Switch(in C) and SELECT(in Clist/Rexx) are used to avoid multiple IF-ELSE statement. i don’t say they are exactly same but they are similar
switch( expression )
     {
        case constant-expression1:   statements1;
        [case constant-expression2:   statements2;]   
        [case constant-expression3:   statements3;]
        [default : statements4;]
     }

SELECT [test expression]
              WHEN expression1 ...
                (action) ...
               WHEN expression2
               WHEN expression3
                [OTHERWISE] ...
               ( action) ...
END


When the test expression is used in the SELECT it is similar to SWITCH (with BREAK statement is used in all the CASE in switch)

Pls correct me if i am wrong..
rajithr007
 
Posts: 13
Joined: Thu Sep 11, 2008 11:31 am
Has thanked: 0 time
Been thanked: 0 time

Re: clist option similar to switch in c language

Postby dick scherrer » Sun Nov 09, 2008 3:33 am

Hi Rajith,

Thanks for the clarification :)

I don't speak "C" and had no idea what "switch" might accomplish :?

'Preciate it,

d
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: clist option similar to switch in c language

Postby rajithr007 » Sun Nov 09, 2008 3:43 pm

Hi Dick,

You are most welcome. :)

Regards
Rajith
rajithr007
 
Posts: 13
Joined: Thu Sep 11, 2008 11:31 am
Has thanked: 0 time
Been thanked: 0 time


Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post