In the case of normal COBOL termination (e.g., GOBACK from main, STOP RUN, 
etc.) or abnormal COBOL termination (e.g., abend with TRAP(ON) in effect), 
COBOL will attempt to close any files that were left open and the C03 abend 
will be avoided. However, if an assembler program dynamically loads a COBOL 
program that opened a file and did not close it and then the assembler 
program deletes the COBOL program, this is where a C03 abend can occur. 
The COBOL Migration Guide says that unpredictable results may occur in 
certain cases if a COBOL program was SVC LOADed and then subsequently 
SVC DELETEd (the C03 abend is one of these unpredictable results).

The COBOL library does not make any distinction as to where the library 
routines are loaded. However, I have seen cases before that when modules 
are loaded from different locations (STEPLIB, JOBLIB, LINKLSK, LPA, etc.), 
they may get loaded in different areas of storage. This would cause a DCB to 
be getmained at a different address. Then, when the COBOL program is 
deleted and if the DCB also gets freed (but the storage is not reused), the 
task termination code could still find the DCB "in storage" and can close the 
file successfully. However, if the DCB stoage got reused after the DCB was 
freed, task termination would no longer find the DCB in storage and would 
issue the C03 abend. 

So, seeing the C03 abend when putting the SCEERUN library in LPA or LINKLST 
vs. STEPLIB or JOBLIB may not actually be the cause of the problem, but 
rather may have just exposed the problem due to the way that storage was 
allocated and freed. It could be that your application was just lucky in not 
getting the abend until now when the storage usage was different.

The correct solution is to always close your files before ending the 
application. 
It that is not possible for some reason, then do not delete the COBOL program 
that was SVC loaded by an assembler program until after the COBOL 
environment has terminated.

Rick Arellanes
IBM COBOL Development

-----Original Message-----
On Mon, 20 Oct 2008 10:00:50 +0300, Mürsel Taşgın 
<[EMAIL PROTECTED]> wrote:

>Hi,
>It is a DB2 Cobol program and make calls to other programs compiled with
>ASM, Enterprise Cobol and 1 VS Cobol program.
>
>We think that there is a problem with the program (ie. Not closing datasets
>properly etc.) But we cannot understand why does it work with 
CEE.SCEERUN in
>JOBLIB and doesn't work when it needs to call it from LNKLST.
>
>Thanks and regards.
>
>Mürsel Taþgýn
>BT Sistem Yönetimi
>Yönetici Yardýmcýsý
>
>Akbank Genel Müdürlüðü
>Sabancý Center 34330, Ýstanbul
>Tel: + 90 212 385 53 85
>Faks: +90 212  282 62 76
>[EMAIL PROTECTED]
>

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to