> -----Original Message-----
> From: IBM Mainframe Discussion List 
> [mailto:[EMAIL PROTECTED] On Behalf Of Kok, Howi
> Sent: Wednesday, June 22, 2005 12:12 PM
> To: [email protected]
> Subject: Help on SC03 abend
> 
> 
> Hi
> 
> I'm not sure if I should post this in this list.  Anyway, I 
> hope some of
> you can help me out.  We have a batch DB2 COBOL program PGMA 
> that calls
> an assembler program PGMB to open, read, and close four VSAM files.  I
> don't know why PGMB closes only two of the files.  
> 
> Upon PGMA termination we would get SC03 abends with messages IEC999I
> IFG0TC0A,IFG0TC0B,jobname,stepname,DEB ADDR = debaddr,DSN = VSAM data
> set name  for the two closed files.  All the programs are in 
> AMODE31 and
> we are at z/OS 1.4.  According to the programmer there is no problem
> when the PGMB is called from a non-DB2 COBOL program.  What should be
> done differently when the assembler program is called from a DB2 COBOL
> program?  Should we not close any files and let the system detect the
> DEBs and close them?  Thanks for your help.
> 
>  
> 
> Howi Kok

I have had this happen as well, but I wasn't even using DB2 (but it may
have been IMS batch). What the problem is, is that the DCB is "hard
coded" in the assembler routine. When a DCB is OPENed, a DEB is created
on the TCB DEB chain. This DEB points back to the DCB and the DCB points
to the DEB (i.e. they point to each other). If you don't close the DCB
yourself, at task termination, z/OS will attempt to do the CLOSE for
you. It takes the DCB pointer from the DEB and checks that the the DEB
pointer within the DCB still points to the DEB. If it does not, you get
that abend and the message.

What is happening is that on the first COBOL CALL, the COBOL run-time is
doing a LOAD on the assembler program. When the COBOL run-unit finishes,
the run-time does a DELETE on all LOADed modules. This releases the
memory which was assigned to the assembler program. Most likely, this
will result in a FREEMAIN of the page of memory containing the DCB. So,
when task termination tries to access the memory, it either gets (and
recovers from) an S0C4 or it gets "junk" (likely binary zeroes). In
either case, the DCB is gone and you get the SC03 and the message.

The assembler routine needs to be change to either (1) CLOSE all the
DCBs or (2) create the DCB in an area outside itself using a GETMAIN
(STORAGE OBTAIN), or (3) cheat like the dickens and do a LOAD on itself
so that the load count is 2. But doing the last, the DELETE issued by
the run-time will NOT result in the assembler program actually being
deleted (just reduce its load count by 1).

I do not know of any way to avoid this without modifying the assembler
routine. Oh, wait, yes there is. Write another assembler subroutine.
Have this subroutine do a LOAD on the original assembler routine. This
will also increase the load count.
--
John McKown
Senior Systems Programmer
UICI Insurance Center
Information Technology

This message (including any attachments) contains confidential
information intended for a specific individual and purpose, and its'
content is protected by law.  If you are not the intended recipient, you
should delete this message and are hereby notified that any disclosure,
copying, or distribution of this transmission, or taking any action
based on it, is strictly prohibited.

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