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
 

 

what is the purpose of WITH TEST AFTER

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

Active User


Joined: 23 May 2006
Posts: 166
Location: chennai

PostPosted: Fri Mar 30, 2007 3:33 pm    Post subject: what is the purpose of WITH TEST AFTER
Reply with quote

hi

I came across a code like

PERFORM 1000-para THRU 1000-exit WITH TEST AFTER UNTIL eof-file.


Curious what this WITH TEST AFTER will do..
Back to top
View user's profile Send private message

venosol
Warnings : 1

New User


Joined: 16 Nov 2006
Posts: 43
Location: Bangalore

PostPosted: Fri Mar 30, 2007 3:44 pm    Post subject: Re: what is the purpose of WITH TEST AFTER
Reply with quote

raak wrote:
hi

I came across a code like

PERFORM 1000-para THRU 1000-exit WITH TEST AFTER UNTIL eof-file.


Curious what this WITH TEST AFTER will do..


It will execute the statements in 1000-Para Thru 1000-exit atleast once even after satisfying the condition.

Suppose the eof file is reached and it will execute the statements and then terminate the loop.

There is also WITH TEST BEFORE which will terminate the loop immediately after satisfying the condition without executing the statements.

If you didnot mention anything it will take WITH TEST BEFORE as default.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sun Apr 01, 2007 7:25 pm    Post subject:
Reply with quote

Hi Raak,

An important diff between BEFORE/AFTER is shown in the following:
Code:

01  SUB        PIC S9(004) COMP VALUE 1.


PERFORM 1000-para THRU 1000-exit WITH TEST AFTER   UNTIL SUB >= 1
PERFORM 1000-para THRU 1000-exit WITH TEST BEFORE  UNTIL SUB >= 1

SUB is incemented by 1 in 1000-para.
The PERFORM BEFORE will not exec 1000-para.
The PERFORM AFTER will exec 1000-para once.

If you change the >= to >:

The PERFORM BEFORE will exec 1000-para once.
The PERFORM AFTER will exec 1000-para twice.
Back to top
View user's profile Send private message
livingston

New User


Joined: 20 Feb 2007
Posts: 6
Location: India

PostPosted: Wed Apr 18, 2007 12:41 pm    Post subject: Re: what is the purpose of WITH TEST AFTER
Reply with quote

hi
By default the perform statement perform the paragraph only if the condition that you have specified is true.
it can be overridden by using WITH TEST AFTER ie the paragraph is atleast executed even the condition that you have specified is false.
i think you can be clear now!
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 COOLGEN - TSO TEST FACILITY indianrajput CA Products 4 Wed Nov 02, 2016 9:28 pm
This topic is locked: you cannot edit posts or make replies. How to supply called sub-program from... dchristensen JCL & VSAM 25 Wed Sep 14, 2016 11:36 pm
No new posts Two different PDS production and test... Mani453 CLIST & REXX 6 Fri Nov 20, 2015 2:25 pm
No new posts Weird test results when Xpediter is t... Crunch Compuware & Other Tools 6 Tue Oct 06, 2015 7:48 pm
No new posts Test for multiple equality prino CLIST & REXX 2 Tue Sep 15, 2015 12:47 am


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