Virgani Dhirgac
New Member
Gurus,
Errr First, hope I can speak clearly about this
Let's say that I've a codes like this:
------------------------------------------------------------------------------------------------
define variable aclass1 as integer extent 10 initial 0.
define variable aclass2 as integer extent 10 initial 0.
define variable aclass3 as integer extent 10 initial 0.
define variable nclass as integer label "Which Class".
define variable nloop as integer initial 1.
update nclass with frame nclass.
/*
assume nclass is not zero, and user's entry is 1 .. or 2 .. or 3 and so on ....
*/
case nclass:
when 1 then do:
do nloop = 1 to 10:
display aclass1[nloop] with frame xx.
end.
end.
when 2 then do:
do nloop = 1 to 10:
display aclass2[nloop] with frame xx.
end.
end.
when 3 then do:
do nloop = 1 to 10:
display aclass3[nloop] with frame xx.
end.
end.
end case.
------------------------------------------------------------------------------------------------
the question is, can I make above code more shorter with something like this:
do nloop = 1 to 10:
display aclass&&string(nclass)[nloop] with frame xx.
end.
so I dont have to use "CASE ... END CASE" ....
Hope you can understand.
Rgds,
Virgani
Errr First, hope I can speak clearly about this
Let's say that I've a codes like this:
------------------------------------------------------------------------------------------------
define variable aclass1 as integer extent 10 initial 0.
define variable aclass2 as integer extent 10 initial 0.
define variable aclass3 as integer extent 10 initial 0.
define variable nclass as integer label "Which Class".
define variable nloop as integer initial 1.
update nclass with frame nclass.
/*
assume nclass is not zero, and user's entry is 1 .. or 2 .. or 3 and so on ....
*/
case nclass:
when 1 then do:
do nloop = 1 to 10:
display aclass1[nloop] with frame xx.
end.
end.
when 2 then do:
do nloop = 1 to 10:
display aclass2[nloop] with frame xx.
end.
end.
when 3 then do:
do nloop = 1 to 10:
display aclass3[nloop] with frame xx.
end.
end.
end case.
------------------------------------------------------------------------------------------------
the question is, can I make above code more shorter with something like this:
do nloop = 1 to 10:
display aclass&&string(nclass)[nloop] with frame xx.
end.
so I dont have to use "CASE ... END CASE" ....
Hope you can understand.
Rgds,
Virgani