Page 1 of 1

What is the difference between CANCEL and INITIAL statement

Posted: Thu Oct 12, 2006 12:25 pm
by vjrithwik
Hi,

What is difference between CANCEL and INITIAL statements.

Posted: Thu Oct 12, 2006 5:22 pm
by Krishna
Hi Rithwik,

CANCEL is used to initialize the sub-program. INITIAL is used to initialise the same program.
More information.........

CANCEL statement.
-----------------------

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

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.)



NOTE : No action is taken when a CANCEL statement is executed, if subprogram has not been dynamically called.



INITIAL Statement
-----------------------

Specifies that when program-name is called, program-name and any programs contained
within it are placed in their initial state. The INITIAL attribute is not supported for programs
compiled with the THREAD option.

INITIAL statement is used with PROGRAM-ID statement.




Thanks,
Krishna

Posted: Tue Jun 01, 2010 1:21 pm
by gmt360
Sorry for replying to an older post.
If not valid pls let me know, however it is related.

Do we use IS INITIAL in sub-program only?

Dynamically called programs are always in Initial Mode, Is it automatic or do we need to Code IS INITIAL or CANCEL?/

Pls reply

thanks

Garry

Posted: Tue Jun 01, 2010 11:36 pm
by dbzTHEdinosauer
Dynamically called programs are always in Initial Mode
not true

only for first CALL. after that, without a CANCEL, next time pgm is CALLed, it is in last left status.

Posted: Tue Jun 01, 2010 11:37 pm
by dbzTHEdinosauer
Dynamically called programs are always in Initial Mode
not true

only for first CALL. after that, without a CANCEL, next time pgm is CALLed, it is in last left status.

only with the program-id clause INITIAL,
will a program (dynamically or statically) be load on each CALL in initial state.

Topic deleted by Admin

Posted: Wed Jan 27, 2016 8:32 pm
by academyindia4
<< Content deleted By Admin >>

Topic deleted by Admin

Posted: Sat Jan 30, 2016 11:42 pm
by academyindia4
<< Content deleted By Admin >>

Topic deleted by Admin

Posted: Mon Feb 01, 2016 10:10 pm
by academyindia4
<< Content deleted By Admin >>