IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

CANCEL Statement in cobol


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
naveen9

New User


Joined: 09 Mar 2005
Posts: 3
Location: bangalore

PostPosted: Wed Mar 09, 2005 7:24 pm
Reply with quote

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

New User


Joined: 20 Oct 2004
Posts: 59

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

Hi,
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.

Regds
sunny
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sun Mar 13, 2005 7:22 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts Generate random number from range of ... COBOL Programming 3
Search our Forums:

Back to Top