Here, i have included coding part. Can anyone give the answer?
will the control back to para-1 if i execute goto statement????
Program:
Perform para-1 thru para-1-exit.
para-1.
Move 1 to ws-count
Display 'aaaa'
Goto para-2
para-1-exit.
Exit.
para-2.
Display 'bbbb'.
GOTO statement function
-
- Posts: 2
- Joined: Fri Feb 22, 2008 5:39 pm
- Skillset: Beginner
- Referer: Search engine
Re: GOTO statement function
No, whatever is after para-2 will be executed...Ajith Kumar wrote:Here, i have included coding part. Can anyone give the answer?
will the control back to para-1 if i execute goto statement????
Program:Code: Select all
Perform para-1 thru para-1-exit.
para-1.
Move 1 to ws-count
Display 'aaaa'
Goto para-2
para-1-exit.
Exit.
para-2.
Display 'bbbb'.
If nothing is after para-2, an implicit stop run/goback will take place.
-
- Posts: 2
- Joined: Fri Feb 22, 2008 5:39 pm
- Skillset: Beginner
- Referer: Search engine
Re: GOTO statement function
Suppose if there is an 'DISPLAY "cccc"' statement after GOTO statement, will 'cccc' displayed or not?
-
- Posts: 110
- Joined: Thu Dec 27, 2007 5:18 pm
- Skillset: Known little stuffs to answer a few queries!!
- Referer: Google
- Contact:
Re: GOTO statement function
Ajith Kumar,
Did you tried running your code? You have given the code, then why are you hesitating to run that? Try that and let us know.
Arun.
Did you tried running your code? You have given the code, then why are you hesitating to run that? Try that and let us know.
Arun.
Re: GOTO statement function
Of course not, why would you even think it might?Ajith Kumar wrote:Suppose if there is an 'DISPLAY "cccc"' statement after GOTO statement, will 'cccc' displayed or not?
-
- Posts: 17
- Joined: Mon Feb 18, 2008 10:21 pm
- Skillset: JCL,CICS,COBOL,VSAm,DB2
- Referer: Google
Re: GOTO statement function
Perform cannot contain goto because goto takes the control out of the perform and the control is not returned back.So in your case the control will never come back to para1..To chk ths jus give a display statement in para-1-exit and chk out..Correct me if am wrong pls..
Regards
Nadeem
Regards
Nadeem
Re: GOTO statement function
A rather broad statement.....and not entirely correct.....pcdoctor wrote:Perform cannot contain goto because goto takes the control out of the perform and the control is not returned back.
If the perform was in the paragraph through paragraph form, the 'go to'ed branch could return to a paragraph within the preformed loop....
- dick scherrer
- Global moderator
- Posts: 6268
- Joined: Sat Jun 09, 2007 8:58 am
Re: GOTO statement function
Hello,
There is also often a big difference between what the compiler will allow and what is good programming practice. . .
There is also often a big difference between what the compiler will allow and what is good programming practice. . .
Hope this helps,
d.sch.
d.sch.
Re: GOTO statement function
FWIW, usually the only 'GO TO's I've seen have been to an abend routine or an EOJ routine.....pcdoctor wrote:Perform cannot contain goto because goto takes the control out of the perform and the control is not returned back.
-
- Similar Topics
- Replies
- Views
- Last post
-
- 0
- 1352
-
by yodish
View the latest post
Thu Dec 24, 2020 3:23 am
-
- 4
- 9354
-
by grasshopper
View the latest post
Mon Jul 26, 2021 9:17 am
-
- 8
- 4513
-
by steve-myers
View the latest post
Sat Oct 16, 2021 8:59 pm
-
-
Splice JCL into one record for DD statement parms
by phcribb » Thu Nov 05, 2020 9:31 pm » in CLIST & REXX - 3
- 1972
-
by phcribb
View the latest post
Fri Nov 06, 2020 8:06 pm
-