IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Regarding DO Statement


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
satish.ms10

Active User


Joined: 10 Aug 2009
Posts: 184
Location: India

PostPosted: Wed Nov 18, 2009 9:35 am
Reply with quote

Hi All,

I have following code in one of my PL/I programs,
Code:
DO J = 0, COMPCODE;
   TEMP(J) = TEMP(J) + CSPREM;
   TEMP1(J) = TEMP1(J) + CSCOMP;
   TEMP2(J) =TEMP2(J) + WRCOMP;
END;


Someone please explain me how this DO loop is going to stop iterations?

Thanks in advance.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Nov 18, 2009 10:51 am
Reply with quote

Hello,

At the top of the page is a link to "IBM Manuals" among which is the pl/i Language Reference.

Look here and on the other related pages:
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/handheld/Connected/BOOKS/ibm3lr60/9.16.1

The DO posted will execute one time. There will be no iterations.
Please see below. . . d
Back to top
View user's profile Send private message
satish.ms10

Active User


Joined: 10 Aug 2009
Posts: 184
Location: India

PostPosted: Wed Nov 18, 2009 11:43 am
Reply with quote

Hi Dick,

Thanks the quick and courteous response.

I have gone thru the manuals and I understand that my code will execute two times.

Here is the message from manual
Quote:
The following DO statement executes the do-group three times--once for each assignment of 'Tom', 'Dick', and 'Harry' to Name.


do Name = 'Tom', 'Dick', 'Harry';


and link for reference is
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/handheld/Connected/BOOKS/ibm3lr60/9.16.4?SHELF=&DT=20071130131006&CASE=

Thank you once again.

Please correct me if my understanding is wrong.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Nov 18, 2009 8:41 pm
Reply with quote

Hello,

I mis-read your code. . . icon_redface.gif

Did you try the code? What happened?

Also, please note that the link you gave does not point to the intended documentation page. If you mouse-over the link you can see where it really points. Let me know and i'll fix this.
Corrected in the original post
Back to top
View user's profile Send private message
satish.ms10

Active User


Joined: 10 Aug 2009
Posts: 184
Location: India

PostPosted: Thu Nov 19, 2009 9:47 am
Reply with quote

Hi Dick,

Sorry for the inconvenience

I have corrected the link. Since I do not have job testing authority I did not test the code.

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/handheld/Connected/BOOKS/ibm3lr60/9.16.4?SHELF=&DT=20071130131006&CASE=

Thank you very much.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Nov 19, 2009 10:03 am
Reply with quote

You're welcome icon_smile.gif

Quote:
Sorry for the inconvenience
Not to worry. I caused more inconvenience than you did. . .

I don't have access to a pl/i compiler, so i didn't test either. . .

Hopefully, one of the pl/i folks will confirm our understanding.
Back to top
View user's profile Send private message
Srihari Gonugunta

Active User


Joined: 14 Sep 2007
Posts: 295
Location: Singapore

PostPosted: Thu Nov 19, 2009 3:17 pm
Reply with quote

Satish,
This loop is executed twice. first time J value is 0 and second time with a value from COMPCODE.

For better understanding consider this.

DO J=0,1,2,3,4;
END;

Above loop will execute five times with J using the supplied values 0,1,2,3,4.

Hope this helps.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts JOIN STATEMENT PERFORMANCE. DFSORT/ICETOOL 12
No new posts Relate COBOL statements to EGL statement All Other Mainframe Topics 0
No new posts process statement for SUPREC, CMPCOLM... TSO/ISPF 4
No new posts SYNCSORT/ICETOOL JOINKEYS SORT Statem... DFSORT/ICETOOL 13
No new posts DFDSS COPY using Filter REFDT statement JCL & VSAM 2
Search our Forums:

Back to Top