Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
CANCEL Statement in cobol

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

New User

Joined: 09 Mar 2005
Posts: 3
Location: bangalore

PostPosted: Wed Mar 09, 2005 7:24 pm    Post subject: CANCEL Statement in cobol
Reply with quote

What is cancel statement in COBOL
Back to top
View user's profile Send private message


New User

Joined: 20 Oct 2004
Posts: 59

PostPosted: Wed Mar 09, 2005 7:36 pm    Post subject:
Reply with quote

The CANCEL command is used when you are calling a subprogram dynamically.When u issue cancel command after a dynamic call to subprogram,it will refresh or reset all the parameters that got updated in subprogram.

The CANCEL statement ensures that the next time the referenced subprogram is called it will be entered in its initial state.

If using dynamic CALL, for the first CALL for a given module, that module is loaded into memory. CANCEL for that same program name will remove it from memory.

When a CANCEL statement is executed, all programs contained within the program referenced by the CANCEL statement are also canceled.

A program can, however, cancel a program that it did not call, providing that,
in the calling hierarchy, it is higher than or equal to the program it is canceling.
For example:

A calls B and B calls C (When A receives control, it can cancel C.)

A calls B and A calls C (When C receives control, it can cancel B.)

A CANCEL statement:

Closes all open files
Operates only on the program specified, and not on any program that may have been called by the canceled program.

No action is taken when you use a CANCEL statement to cancel the following types of programs:

A program that has not been called in the run unit
A program that has been called and subsequently canceled.

Back to top
View user's profile Send private message

Super Moderator

Joined: 30 May 2003
Posts: 1592

PostPosted: Sun Mar 13, 2005 7:22 am    Post subject:
Reply with quote

As Sunnyk stated these things seem to happen and from one perspective it's not "wrong" to think that.

But what actually happens is that the current version of the CALLed pgm is CANCELed, that is, it's no longer active. The memory originally allocated to that version is freed and becomes available to the next requestor and the next CALL of that pgm is loaded from disk and must compete for task memory (which may or may not be available then).

Because of this load all Working storage appears to be reinitialized. In fact the pgm is reloaded with its original WS contents.
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 Linkage editor is part of COBOL, z/OS... ankit.jain COBOL Programming 4 Fri Apr 20, 2018 4:17 pm
This topic is locked: you cannot edit posts or make replies. Difference between EQUAL and EQUAL TO... jithinraghavan COBOL Programming 3 Thu Apr 19, 2018 2:22 am
No new posts Call COBOL or PLI with a click from w... vaibhav gs All Other Mainframe Topics 1 Mon Apr 16, 2018 7:29 pm
No new posts COBOL MVS options BiswajitDG COBOL Programming 8 Fri Apr 06, 2018 12:35 am
No new posts batch cobol/db2 paragraph fall thru a... alois eisshofer COBOL Programming 5 Wed Mar 14, 2018 12:21 am

Back to Top
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us