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
 

 

Questions related to EXIT-PROGRAM.

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

New User


Joined: 29 Nov 2005
Posts: 49

PostPosted: Fri Mar 17, 2006 5:23 pm    Post subject: Questions related to EXIT-PROGRAM.
Reply with quote

Hi,

Could you please answer for these questions.

1. Difference between EXIT & EXIT-PROGRAM?

2. Difference between EXIT & GOBACK?

3. What will happen if i code GOBACK & STOP RUN in same program?

4. I have a following structure.

01 A PIC X(100) VALUE 'NAME SALARY NAME SALARY NAME SALARY
...........'
Like that 100 characters. Now i want to display the above one is as follows.

NAME SALARY

NAME SALARY
.
.
.
NAME SALARY.

Please tell me the code for this.

Please let me know the answers for above questions.

Thanks,
Sunny.
Back to top
View user's profile Send private message

martin9

Active User


Joined: 01 Mar 2006
Posts: 287
Location: Basel, Switzerland

PostPosted: Fri Mar 17, 2006 6:03 pm    Post subject:
Reply with quote

hy sunnybunny,

1. EXIT means EXIT from a paragraph you just performed,
EXIT-PROGRAM you finish the program.

2. GOBACK you code normally for subroutines,
it is like EXIT-PROGARM but returns to the caller.

3. EXIT-PROGRAM is like STOP-RUN...
finishing the program

4. 01 A PIC X(100) VALUE 'NAME SALARY NAME SALARY NAME SALARY...
i assume NAME and SALARY alre always from different length.
if so, then STRING/UNSTRING this stuff. if the sizes for NAME and SALARY
are from the same length, i.e. NAME PIC X(20), SALARY PIC 9(05),
then you can redefine your variable with an array, and display its value
in a loop....

martin9
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1452
Location: Chicago, IL

PostPosted: Fri Mar 17, 2006 6:25 pm    Post subject: Re: Questions related to EXIT-PROGRAM.
Reply with quote

Hi Martin,

Quote:
2. GOBACK you code normally for subroutines,
it is like EXIT-PROGARM but returns to the caller.

Is there any difference between GOBACK & EXIT-PROGRAM. Basically GOBACK returns the control to caller if coded in a called module or simply STOP FUNCTIONS if coded in Main module.
And Isn't EXIT-PROGRAM doing the same.

Regards,
Priyesh.
Back to top
View user's profile Send private message
martin9

Active User


Joined: 01 Mar 2006
Posts: 287
Location: Basel, Switzerland

PostPosted: Fri Mar 17, 2006 7:44 pm    Post subject:
Reply with quote

hy priyesh,

actually yes,
STOP RUN will break any flow...
therefore you are right.

martin9
Back to top
View user's profile Send private message
cheryala

New User


Joined: 20 Mar 2006
Posts: 46

PostPosted: Mon Mar 20, 2006 7:05 pm    Post subject: Re: Questions related to EXIT-PROGRAM.
Reply with quote

Hi Everybody,

Just i need to add some more info ..

EXIT-PROGRAM-------> No action will be taken if you use it in your main program ..but if you use it in any sub program then the control will transfer to calling program.

GOBACK---------> When it is used in the main program, stops the program when executed and control will be returned to OS....where is when it is used in subprogram, control will be returned to the calling program..

STOP RUN ---> When it is executed either in main program or sub program, program execution will be stopped and the control will be returned to OS.

Please let me know if i'm wrong any where..

Thanks and Regards,
RS
Back to top
View user's profile Send private message
ap_mainframes

Active User


Joined: 29 Dec 2005
Posts: 181
Location: Canada

PostPosted: Thu Mar 23, 2006 9:28 am    Post subject: Re: Questions related to EXIT-PROGRAM.
Reply with quote

Hi,

Just wanted to add a point regarding this.
I saw the replies and found one of the answers as
"EXIT means EXIT from a paragraph you just performed"

As far as I know, it doesnt do that !!
A paragraph identifies that it is done when it encounters a new PARA AND NOT when it encounters exit. So basically EXIT does nothing and is just a way of coding.

Any corrections and always welcome.

ap_mainframes
Back to top
View user's profile Send private message
gowtham_1982
Warnings : 1

Active User


Joined: 02 Dec 2005
Posts: 109

PostPosted: Fri Mar 24, 2006 10:04 am    Post subject: Re: Questions related to EXIT-PROGRAM.
Reply with quote

ap_mainframes wrote:
Hi,

Just wanted to add a point regarding this.
I saw the replies and found one of the answers as
"EXIT means EXIT from a paragraph you just performed"

As far as I know, it doesnt do that !!
A paragraph identifies that it is done when it encounters a new PARA AND NOT when it encounters exit. So basically EXIT does nothing and is just a way of coding.

Any corrections and always welcome.

ap_mainframes


i too support ap_mainframes. to add with, a paragraph also ends when it finds there are no more statement to be executed from it. an EIXT statement does nothing other than to exit from the paragraph. if an EXIT statement is coded, it should be the only statement in the paragraph.

sorry if i'm revisiting the grounds agains.

kind regards,

gowtham
Back to top
View user's profile Send private message
umeshkmrsh

New User


Joined: 21 Sep 2005
Posts: 79
Location: India

PostPosted: Tue Mar 28, 2006 1:47 pm    Post subject:
Reply with quote

EXIT statement does nothing. It never exists from a paragraph. A paragraph ends when we reach another para or section.

As every peragraph needs to have at least one statement, we use EXIT as its more meaningful.

I hope this makes it clear that why EXIT is used and what it does.
Back to top
View user's profile Send private message
umeshkmrsh

New User


Joined: 21 Sep 2005
Posts: 79
Location: India

PostPosted: Tue Mar 28, 2006 1:54 pm    Post subject: Re: Questions related to EXIT-PROGRAM.
Reply with quote

cheryala wrote:
Hi Everybody,

Just i need to add some more info ..

EXIT-PROGRAM-------> No action will be taken if you use it in your main program ..but if you use it in any sub program then the control will transfer to calling program.

GOBACK---------> RS


Are you sure that EXIT-PROGRAM does nothing when used in main program? I doubt it does nothing.

Anyone please clear this topic, as most of the replies are contradictory.
What is diff bet EXIT-PROGRAM , GOBACK and STOP RUN.

What is know is:
STOP RUN -- stops current rununit (wherever it is used main or sub program)
GOBACK = EXIT-PROGRAM --- (if used in main program they are = STOP RUN and if used in sub-program they return control to main program).

Please correct if I am wrong.
Back to top
View user's profile Send private message
tusharguptait

New User


Joined: 15 Feb 2006
Posts: 32

PostPosted: Wed Mar 29, 2006 9:32 am    Post subject: Re: Questions related to EXIT-PROGRAM.
Reply with quote

Hi,

->STOP RUN is the last executable statement of the main program ( or sub program ). It returns control back to OS.

->GOBACK can be coded in main program as well as sub-program as the last statement. It just gives the control back from where it received the control.

->EXIT PROGRAM is the last executable statement of sub-program. It returns control back to main program. However in main program the EXIT PROGRAM will act as a NULL statement and execution will continue from next impertative statement.

->EXIT acts as a NULL statement and does nothing. If used it should be the only statement in the para.

Thanks.
TG
Back to top
View user's profile Send private message
mubashir.surury

New User


Joined: 29 Sep 2005
Posts: 23
Location: Pune

PostPosted: Wed Mar 29, 2006 5:12 pm    Post subject:
Reply with quote

hi sunnybunny;
for your last question u can use REDEFINES clause in the foolowing manner.assuming name and sakary both are 5 bytes long.

Code:

 01 A PIC X(100) VALUE 'NAME SALARY NAME SALARY NAME SALARY
 01 B REDEFINES A.
      05  NAME-SALARY OCCURS 10 TIMES INDEXED BY X.
           10 NAME        PIC X(5).
           10 SALARY     PIC 9(5).


and then you can use PERFORM statement to display the same on a new line each.
Code:

             PERFORM VARYING X FROM 1 BY 1 UNTIL X = 10
                 DISPLAY NAME-SALARY(X)
             END-PERFORM.

just check on the use of index for an array.i am not sure of the syntax.
hope that helps.
corrections are welcome
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 Executing OO COBOL program invoking J... Virendra Shambharkar COBOL Programming 2 Tue Jan 10, 2017 6:37 pm
No new posts Need Suggestion on COBOL program vickey_dw COBOL Programming 5 Thu Jan 05, 2017 10:55 pm
No new posts Viewing executing process in NDM .. q... Debb.Brant IBM Tools 0 Wed Dec 14, 2016 10:55 pm
No new posts I can not compile my program PL1 V3.R... Miguel Fernandez PL/I & Assembler 13 Tue Dec 06, 2016 8:30 pm
No new posts IMS BMP program causes 878 system abend Artemk IMS DB/DC 7 Tue Nov 22, 2016 8:26 pm


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