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
 

 

Regarding DO Statement

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

Active User


Joined: 10 Aug 2009
Posts: 158
Location: India

PostPosted: Wed Nov 18, 2009 9:35 am    Post subject: Regarding DO Statement
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

Site Director


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

PostPosted: Wed Nov 18, 2009 10:51 am    Post subject:
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:
http://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: 158
Location: India

PostPosted: Wed Nov 18, 2009 11:43 am    Post subject:
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
http://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

Site Director


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

PostPosted: Wed Nov 18, 2009 8:41 pm    Post subject:
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: 158
Location: India

PostPosted: Thu Nov 19, 2009 9:47 am    Post subject:
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

Site Director


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

PostPosted: Thu Nov 19, 2009 10:03 am    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts -913/-911 Deadlock during UPDATE stat... NoSleep319 DB2 5 Fri Nov 18, 2016 12:37 am
No new posts COBOL DB2 - CALL statement - high CPU... TS70363 DB2 15 Sun Sep 11, 2016 6:07 am
No new posts Converting NULL column into NOT NULL ... Raghu navaikulam DB2 5 Sat Aug 06, 2016 3:45 pm
This topic is locked: you cannot edit posts or make replies. Updating value of key using rewrite s... ParminderKumar COBOL Programming 4 Thu Aug 04, 2016 12:46 am
No new posts Inspect statement spoorni COBOL Programming 5 Mon Jun 06, 2016 9:53 pm


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