is multiple STOP RUN are valid?

This is a Mainframe COBOL forum - you can post your queries on Mainframe COBOL, VS COBOL II, COBOL/370 , Enterprise COBOL

Moderators: dbzTHEdinosauer, Moderator Group

sekhar19
Member
Posts: 5
Joined: Wed Jun 17, 2009 5:20 pm

is multiple STOP RUN are valid?

Post by sekhar19 » Thu Jul 09, 2009 2:23 pm

1. Coding Multiple STOP RUN is valid?
if yes which will take top precedence?

User avatar
dbzTHEdinosauer
Moderator
Posts: 981
Joined: Mon Oct 02, 2006 8:31 pm

Post by dbzTHEdinosauer » Thu Jul 09, 2009 2:42 pm

yes,
which ever is executed first.
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.

sekhar19
Member
Posts: 5
Joined: Wed Jun 17, 2009 5:20 pm

statements after the STOP RUN is valid??

Post by sekhar19 » Thu Jul 09, 2009 2:56 pm

the statements coded after the STOP RUN, is valid???

User avatar
Natarajan
Moderator
Posts: 537
Joined: Fri Oct 10, 2008 12:57 pm
Location: chennai
Contact:

Post by Natarajan » Thu Jul 09, 2009 3:41 pm

Try it once... :D
Natarajan
Chennai

User avatar
arcvns
Member
Posts: 28
Joined: Sat May 30, 2009 10:19 pm
Location: Chennai, India

Post by arcvns » Thu Jul 09, 2009 6:38 pm

the statements coded after the STOP RUN, is valid???
Only if the same is "valid" when coded before STOP RUN :D
Arun

arunaa27
Member
Posts: 2
Joined: Wed Jul 08, 2009 8:18 pm
Location: Bloomington,IL,USA

Post by arunaa27 » Fri Jul 10, 2009 3:10 am

I never tried this before. But, after the first STOP RUN executed, there will be no statements executed. But, DO NOT USE STOP RUN in your COBOL coding.... IT IS NOT ADVISABLE... Instead of this, you can use GOBACK.
Arun

User avatar
Natarajan
Moderator
Posts: 537
Joined: Fri Oct 10, 2008 12:57 pm
Location: chennai
Contact:

STOPRUN vs GOBACK

Post by Natarajan » Fri Jul 10, 2009 10:24 am

arunaa27 wrote: But, DO NOT USE STOP RUN in your COBOL coding.... IT IS NOT ADVISABLE... Instead of this, you can use GOBACK.

Why are suggesting GOBACK instead of STOP RUN.
Are you talking about COBOL CICS programs?
Natarajan
Chennai

User avatar
dbzTHEdinosauer
Moderator
Posts: 981
Joined: Mon Oct 02, 2006 8:31 pm

Post by dbzTHEdinosauer » Fri Jul 10, 2009 12:38 pm

If you use STOP RUN in a CALLed module of a Batch Rununit, the rununit will stop.
that is why usage of GOBACK is always perfered.
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.

User avatar
Natarajan
Moderator
Posts: 537
Joined: Fri Oct 10, 2008 12:57 pm
Location: chennai
Contact:

Post by Natarajan » Fri Jul 10, 2009 2:07 pm

Yes dick you are correct. I agree with your statement.

Arun is giving open statement - ' DONT USE STOP RUN IN COBOL programs'.
Not specfiied called programs, cics programs or normal cobol programs.
Natarajan
Chennai

User avatar
dbzTHEdinosauer
Moderator
Posts: 981
Joined: Mon Oct 02, 2006 8:31 pm

Post by dbzTHEdinosauer » Fri Jul 10, 2009 2:38 pm

I agree with Arun: STOP RUN is an old instruction from back in the days when we did not code modularly. you can code GOBACK instead of STOP RUN anywhere. It is considered good practice now-a-days not to use STOP RUN.
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.

User avatar
Natarajan
Moderator
Posts: 537
Joined: Fri Oct 10, 2008 12:57 pm
Location: chennai
Contact:

Post by Natarajan » Fri Jul 10, 2009 9:17 pm

Is there any specific reason for suggesting GOBACK instead of STOP RUN , even in normal cobol programs ( i am not talking about sub programs, cics programs )
Natarajan
Chennai

User avatar
dbzTHEdinosauer
Moderator
Posts: 981
Joined: Mon Oct 02, 2006 8:31 pm

Post by dbzTHEdinosauer » Fri Jul 10, 2009 10:36 pm

they can never be CALLed.

main modules coded with GOBACK, that acquire their input and output from other than linkage, could be used as submodules.

a lot easier to just always use GOBACK, and not rely on the coder to make the differentiation;
looking thru these forums and experience in the field has lead me and others to insist on GOBACK.
Just one less problem to deal with.

Besides, how many main modules are written in comparision to CICS or submodules?

But if you want to code STOP RUN all the time, that is your business.
you just have to remember to use GOBACK when appropriate.
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.

Anuj Dhawan
Moderator
Posts: 1625
Joined: Sat Aug 09, 2008 9:02 am
Location: Mumbai, India

Post by Anuj Dhawan » Sat Jul 11, 2009 9:31 am

Coding Multiple STOP RUN is valid?
May be I sound stubborn if I ask, why would you like to do that?
Regards,
Anuj

Anuj Dhawan
Moderator
Posts: 1625
Joined: Sat Aug 09, 2008 9:02 am
Location: Mumbai, India

Post by Anuj Dhawan » Sat Jul 11, 2009 10:17 am

My current shop will not allow STOP RUN in any production code.

The GOBACK statement functions like the EXIT PROGRAM statement when it is coded as part of a called program and like the STOP RUN statement when coded in a main program.

One might ask , Does any version of COBOL support STOP RUN anymore?

While the compiler still supports STOP RUN, many organizations do not allow it to be used. One of the things checked in the promotion process is that GOBACK is used and there is no STOP RUN in the code.
Regards,
Anuj

Anuj Dhawan
Moderator
Posts: 1625
Joined: Sat Aug 09, 2008 9:02 am
Location: Mumbai, India

Post by Anuj Dhawan » Sat Jul 11, 2009 10:19 am

Natarajan wrote:Is there any specific reason for suggesting GOBACK instead of STOP RUN , even in normal cobol programs ( i am not talking about sub programs, cics programs )
Other exception here can be IMS-COBOL program. IMS programs run under the control of batch initilization module DFSRRC00.If you code Stop Run the control is return to OS instead of DFSRRC00. So code GOBACK to give the control back to the called module its DFSRRC00.
Regards,
Anuj

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others