View previous topic :: View next topic
|
Author |
Message |
livingston
New User
Joined: 20 Feb 2007 Posts: 6 Location: India
|
|
|
|
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 |
|
|
guptae
Moderator
Joined: 14 Oct 2005 Posts: 1208 Location: Bangalore,India
|
|
|
|
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 |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
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 |
|
|
livingston
New User
Joined: 20 Feb 2007 Posts: 6 Location: India
|
|
|
|
thank you very much! |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
What? Speak up ! I'm hard of seeing. |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
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 |
|
|
|