Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Perform para to execute the condition first

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
praveenbl22
Currently Banned

New User


Joined: 26 Sep 2007
Posts: 24
Location: Bangalore

PostPosted: Thu Nov 29, 2007 12:16 pm    Post subject: Perform para to execute the condition first
Reply with quote

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
View user's profile Send private message

murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Thu Nov 29, 2007 1:57 pm    Post subject:
Reply with quote

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
View user's profile Send private message
balakrishna reddy

Active User


Joined: 13 Jul 2007
Posts: 130
Location: Guntur

PostPosted: Fri Nov 30, 2007 11:40 am    Post subject:
Reply with quote

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
View user's profile Send private message
praveenbl22
Currently Banned

New User


Joined: 26 Sep 2007
Posts: 24
Location: Bangalore

PostPosted: Fri Nov 30, 2007 11:59 am    Post subject:
Reply with quote

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
View user's profile Send private message
balakrishna reddy

Active User


Joined: 13 Jul 2007
Posts: 130
Location: Guntur

PostPosted: Fri Nov 30, 2007 2:28 pm    Post subject:
Reply with quote

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
View user's profile Send private message
jagdishborde

New User


Joined: 14 Sep 2007
Posts: 1
Location: pune

PostPosted: Fri Nov 30, 2007 4:19 pm    Post subject: for perform para
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Nov 30, 2007 4:48 pm    Post subject:
Reply with quote

are not the options WITH TEST BEFORE and WITH TEST AFTER nolonger accepted syntax for the PERFORM verb?
Back to top
View user's profile Send private message
praveenbl22
Currently Banned

New User


Joined: 26 Sep 2007
Posts: 24
Location: Bangalore

PostPosted: Fri Nov 30, 2007 5:59 pm    Post subject:
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Execute TSO ACF commands from COBOL-I... supreethi.srid TSO/ISPF 0 Tue Feb 21, 2017 5:19 pm
No new posts Joinkeys with condition scdinesh DFSORT/ICETOOL 10 Tue Feb 14, 2017 12:20 am
This topic is locked: you cannot edit posts or make replies. How to pass the previous month date i... Suganya87 DFSORT/ICETOOL 5 Mon Oct 31, 2016 4:13 pm
No new posts Easytrieve - Report writing - Only 1 ... Abhi Nature CA Products 2 Wed Sep 14, 2016 11:40 am
No new posts execute APP if they are not ADDRESS T... italo_pm CLIST & REXX 3 Fri Aug 12, 2016 2:15 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us