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

s0c1 abend while executing SQL statement.


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
dilip_kumar

New User


Joined: 01 Oct 2011
Posts: 3
Location: india

PostPosted: Fri Oct 14, 2011 11:23 pm
Reply with quote

Hi,

I am receiving a S0C1 abend while executing db2 sql statement in PGM-B.

EXEC SQL
SET :WS-TIMESTAMP = CURRENT TIMESTAMP
END-EXEC.

WS-TIMESTAMP is declared as ws variable with X(26).

This PGM-B is a called program in PGM-A.

I compiled PGM-B, did bind and then compiled PGM-A, did bind.

After the above steps I executed PGM-A, its abending with s0c1 in PGM-B.

Please provide your valuable suggests.

Thanks & regards,
Dilip
Back to top
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2547
Location: Silicon Valley

PostPosted: Fri Oct 14, 2011 11:36 pm
Reply with quote

There is something wrong with your compile or linkedit (or your program). Show us your linkedit output. And show us the details of your abend (PSW, registers, etc...)
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Sat Oct 15, 2011 12:01 am
Reply with quote

could be he is making a dynamic call in A (for B), but B is not compiled/linked to be dynamically called.
Back to top
View user's profile Send private message
dilip_kumar

New User


Joined: 01 Oct 2011
Posts: 3
Location: india

PostPosted: Sat Oct 15, 2011 3:51 pm
Reply with quote

Yes, PGM-B is dynamically called, in the sense its initialized value with the PGM-B for ws-variable.

01 WS-PGM-B PIC X(05) VALUE 'PGM-B'.


Call PGM-B USING DFHEIBLK
DFHCOMMAREA
WS-VARIABLES.

And in PGM-B.

PROCEDURE DIVISION USING WS-VARIABLES.

I use chageman tool to compile the programs, first I compile PGM-B and bind and then compile PGM-A and bind.

Unfortunately, I cannot access internet in the machine I program, so I cannot paste the contents of registers and abend info.

Kindly advice.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Sat Oct 15, 2011 4:07 pm
Reply with quote

this really is not a db2 problem.

the CALL USING list suggests that this is a CICS program.

the PROCEDURE DIVISION USING list,
if that is what is in the compile listing,
indicates an inproperly pre-compiled/compiled program.

we need much more infomation,
since the TS apparently has no desire to work with his co-workers
(or possibly they with him/her),
and this
Quote:
Yes, PGM-B is dynamically called, in the sense its initialized value with the PGM-B for ws-variable.
indicates that this thread maybe long and frustrating.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Sat Oct 15, 2011 4:28 pm
Reply with quote

There is something you are missing/doing which others at your site are doing correctly. Sit down with a colleague and go through what you are doing/they are doing.

What it "sounds" like is happening is that your B is not compiled DYNAM but your link/bind is only expecting dynam so the address for a call is not "resolved", so remains zero, so S0C1 (PSW finishes with 00000002 doesn't it?) when your program attempts the call to do the SQL. dbz already aluded to this, but it hasn't had much impact yet.

Without being able to see all the output from everything, all the libraries, and - ideally an equivalent that is working as well - then I don't see that we can get you much further with it.

In short, you're doing it different than others at your site. If you do it the same, it'll work. The best (and possibly only) way to find the difference is to talk to a colleague who has one that is working...
Back to top
View user's profile Send private message
vasanthkumarhb

Active User


Joined: 06 Sep 2007
Posts: 275
Location: Bang,iflex

PostPosted: Sun Oct 16, 2011 12:46 am
Reply with quote

It looks like Dynamic call is not proper. Check PROCEDURE DIVISION USING -------- properly.

This Issue could be linking issue.


Quote:
Call PGM-B USING DFHEIBLK
DFHCOMMAREA
WS-VARIABLES
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Sun Oct 16, 2011 1:06 am
Reply with quote

vasanthkumarhb wrote:
It looks like Dynamic call is not proper. Check PROCEDURE DIVISION USING -------- properly.

This Issue could be linking issue.


Quote:
Call PGM-B USING DFHEIBLK
DFHCOMMAREA
WS-VARIABLES


It could be a linking issue, but I'm not sure you mean that. I think you mean a "linkage" issue.

The CALL looks like a CALL for a CICS program.

The PROCEDURE DIVISION USING looks like the source would look before it has been through the CICS pre-processor. If this is how the PROCEDURE DIVISION USING looks on the compile listing, then it is wrong, for CICS anyway.

However, that is not in itself going to give a S0C1.

Further however, if using the wrong Compile method (no pre-processor) it is probably also using the wrong link-edit method.

Further further however, without feedback from the TS about a lot of specifics dragged out one-at-a-time all we can do is speculate.

Getting hold of the timestamp is far from being a complex thing. TS has done something wrong in their pre-process/compile/link/bind and we can't say much more than that. Might not even be a CICS program, who knows? TS.
Back to top
View user's profile Send private message
vasanthkumarhb

Active User


Joined: 06 Sep 2007
Posts: 275
Location: Bang,iflex

PostPosted: Sun Oct 16, 2011 1:24 am
Reply with quote

Yes i meant linkage issue b/w two programs. Thanks Bill for more info.
Back to top
View user's profile Send private message
dilip_kumar

New User


Joined: 01 Oct 2011
Posts: 3
Location: india

PostPosted: Sun Oct 16, 2011 1:42 am
Reply with quote

Hi all,

Just to summarize the whole thing what I am trying to do,


PGM-B is a existing CICS module, PGM-A is a new batch module I have written to fetch some fields from db2 tables of other application through PGM-B.

Now, since PGM-B being a CICS module I compile it using db2 precompile and CICS pre compile and then bind it, and then compile PGM-A only with db2 pre compile only since it is a batch module.

Invoke PGM-A using JCL. To get clear picture of whats going wrong I have display statements in PGM-B just before and after this EXEC SQL statement. the before display is coming but not after display.

In listing of PGM-B, I can see PROCEDURE DIVISION USING WS-VARIABLES, WS-VARIABLES is same as the one used in PGM-A while calling PGM-B.

Please let me know if there is anything wrong with the way am doing..
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Sun Oct 16, 2011 1:56 am
Reply with quote

Dilip,

If your program B is going through the CICS pre-processor correctly, then you should see three data-names on the USING statement of the PROCEDURE DIVISION, the pre-processor should generate two items in the LINKAGE SECTION for you and insert those in the USING in front of anything that you supply on the USING.

So I don't see how you end up with just USING WS-...

How were you imagining calling CICS from batch would work?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Sun Oct 16, 2011 2:57 am
Reply with quote

Quote:
Please let me know if there is anything wrong with the way am doing..
Yes, there is plenty wrong with your approach. If you site is running, say 100 CICS regions, just how does your batch program get connected to the correct CICS region?

There are well-defined methods for batch programs to interact with CICS programs -- EXCI and FEPI perhaps being the most common -- but just calling a batch program from a CICS program is pretty much guaranteed not to work. Look up EXCI in the CICS External Interface Guide manual (and does the manual title give you a clue?) or find the Front End Programming Interface manual -- either will do what you want.
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 -> DB2

 


Similar Topics
Topic Forum Replies
No new posts ISAM and abend S03B JCL & VSAM 10
No new posts Abend S0C4 11 (Page Translation Excep... PL/I & Assembler 16
No new posts executing XCTL command in COBOL witho... CICS 10
No new posts JOIN STATEMENT PERFORMANCE. DFSORT/ICETOOL 12
No new posts WER999A - UNSUCCESSFUL SORT 8ED U Ab... SYNCSORT 5
Search our Forums:

Back to Top