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
 

 

Is this program (PERFORM VARYING) correct?

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

New User


Joined: 20 Feb 2007
Posts: 6
Location: India

PostPosted: Fri Apr 27, 2007 4:24 pm    Post subject: Is this program (PERFORM VARYING) correct?
Reply with quote

WORKING-STORAGE SECTION.
01 X 9 VALUE ZERO.
PROCEDURE DIVISION.
PERFORM VARYING X FROM 1 BY 1 UNTIL X<3
DISPLAY X
END-PERFORM
STOP RUN.

WHAT WILL BE THE OUT PUT OF THIS PROGRAM?
IT IS COMPILING WELL BUT AFTER RUNNING THE LOAD MODULE AND IF I CHECK FOR THE RESULT IN THE SPOOL AREA I COULDNT ABLE TO SEE THE SYSOUT THERE( I HAVE GIVEN THE SYSOUT IN THE JCL). PLEASE HELP ME TO SOLVE THE ISSUE.

Warning: Don't shout
Back to top
View user's profile Send private message

guptae

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Fri Apr 27, 2007 4:31 pm    Post subject:
Reply with quote

Hi There,

U would not be able to see any value since it wont enter in the loop since u made the condition until X<3 So as soon as value of X will be less than 3 it will come out from the loop since syntactically its correct but not logically that s why u r not getting any compiler error . To see the value of X please change the code as below


Code:
PERFORM VARYING X FROM 1 BY 1 UNTIL X>3
DISPLAY X
END-PERFORM
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Fri Apr 27, 2007 5:05 pm    Post subject: Re: IS THIS PROGRAM(PERFORM VARYING) CORRECT?
Reply with quote

livingston wrote:
WHAT WILL BE THE OUT PUT OF THIS PROGRAM?
Exactly what you found, nothing. The condition was satisfied at the first test and since that test defaults to before, nothing within the perform executed.

Do yourself and the rest of us a favor and learn how to use the "Caps Lock" key on your keyboard (I know you read the forum rules.....).
Back to top
View user's profile Send private message
livingston

New User


Joined: 20 Feb 2007
Posts: 6
Location: India

PostPosted: Mon Apr 30, 2007 12:37 pm    Post subject:
Reply with quote

thank you very much!
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sat May 05, 2007 8:52 pm    Post subject:
Reply with quote

What? Speak up ! I'm hard of seeing.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sun May 06, 2007 10:33 pm    Post subject:
Reply with quote

I might as well add something constructive (somewhat) to the subject:

If you added "WITH TEST AFTER" to your stmt, the pgm would enter the PERFORM loop once and display the subscript.
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 Writing a file using online program grvtomar PL/I & Assembler 3 Fri Jun 30, 2017 1:06 pm
No new posts pre-compiler for program in an HFS Pedro DB2 0 Fri Jun 23, 2017 11:13 pm
No new posts Compiling program in endeavor for tra... RALAKKAL Compuware & Other Tools 4 Mon Jun 05, 2017 8:27 pm
No new posts COBOL DB2 program - zIIP eligible vasanthz COBOL Programming 7 Wed May 31, 2017 5:12 am
No new posts DB2 Program abending without giving a... rahulgarg14 DB2 7 Mon May 29, 2017 8:10 pm


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