View previous topic :: View next topic
|
Author |
Message |
praveenbl22 Currently Banned New User
Joined: 26 Sep 2007 Posts: 24 Location: Bangalore
|
|
|
|
Hi,
How do I perform the para to execute the condition first and increment the variable later?
Code: |
2010-para
Perfrom varying count from 1 by 1 until Flag_true
IF Name = DBtable
Set Flag_True to true
end-IF
end-perform
2010-exit
2000-para
perfrom 2010-para
move count to Hold-count
........
2000-exit
|
Here the count is already increament by one when it exits the loop.
Do Perform after verb will work here or we need to explicitly subtract the count by 1? |
|
Back to top |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
Praveen,
Why dont you modify the 'perform' loop like -
Code: |
Perfrom until Flag_true
IF Name = DBtable
Set Flag_True to true
else
compute count = count + 1
end-IF
end-perform |
|
|
Back to top |
|
|
balakrishna reddy
Active User
Joined: 13 Jul 2007 Posts: 128 Location: Guntur
|
|
|
|
Hi praveen,
solution given by murali should work for you as per your specification.
if not please give us clear picture of your requirement. |
|
Back to top |
|
|
praveenbl22 Currently Banned New User
Joined: 26 Sep 2007 Posts: 24 Location: Bangalore
|
|
|
|
Actually i needed the subscript after preforming the PERFROM Verb, But I found that it was incremented by 1 when it exits the Loop. later in the 2000 when i use the subscript to select the element from the table it was actulay selecting the next element. How can i exit the PERFROM loop when the FLAG is set. I tried with subtracting the the subscript by 1. Is there any other method to do .
Code: |
2010-para
Perfrom varying count from 1 by 1 until Flag_true
IF Name = DBtable
Set Flag_True to true
end-IF
end-perform
2010-exit
2010-para
2000-para
perfrom 2010-para
move SUB to Hold-SUB
........
2000-exit
|
|
|
Back to top |
|
|
balakrishna reddy
Active User
Joined: 13 Jul 2007 Posts: 128 Location: Guntur
|
|
|
|
Hi praveen,
Code: |
Perfrom varying count from 1 by 1 until Flag_true
IF Name = DBtable
Set Flag_True to true
move count to temp
end-IF
end-perform
2010-exit
|
you can use a temporary variable to store that count and use it after the loop. |
|
Back to top |
|
|
jagdishborde
New User
Joined: 14 Sep 2007 Posts: 1 Location: pune
|
|
|
|
hi friends whenever we use varying option that time it first increment & then it execute the condition so muli written is mostly correct,but condition is complicated it may be gone in infinite loop for above example no problem |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
are not the options WITH TEST BEFORE and WITH TEST AFTER nolonger accepted syntax for the PERFORM verb? |
|
Back to top |
|
|
praveenbl22 Currently Banned New User
Joined: 26 Sep 2007 Posts: 24 Location: Bangalore
|
|
|
|
Quote: |
you can use a temporary variable to store that count and use it after the loop.
|
The table is uesd in many place. we do not want to change the code in all the place in order to add the new variable to hold the subscript.
Quote: |
are not the options WITH TEST BEFORE and WITH TEST AFTER nolonger accepted syntax for the PERFORM verb
|
will the WITH TEST AFTER with the perfrom verb works for the below code.
Code: |
code.
2010-para
Perfrom varying SUB from 1 by 1 until Flag_true
IF DATA(SUB) = DBtable
Set Flag_True to true
move 10 to Field1
end-IF
end-perform
2010-exit
2010-para
2000-para
perfrom 2010-para
move SUB to Hold-SUB
........
2000-exit
|
|
|
Back to top |
|
|
|