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

DB2 -981 crashes one cobol program with no affect on another


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

New User


Joined: 26 Feb 2012
Posts: 3
Location: Chicago

PostPosted: Tue Feb 28, 2012 5:57 am
Reply with quote

Hi, this is my first post here.

I have a cobol DB2 programA compiled with NODYNAM that gets a sql -981 when executed.

-981 says (THE SQL STATEMENT FAILED BECAUSE THE RRSAF CONNECTION IS NOT IN A STATE THAT
ALLOWS SQL OPERATIONS).

I have another cobol DB2 programB that executes perfectly when compiled with NODYNAM.

Both programs are compiled, linked, bound and executed using the same JCL.

I have to use NODYNAM because I am calling the setenv module that sets environment variables and creates datasets from COBOL versus from JCL. IBM requires NODYNAM.

ProgramA crashes on the first DB2 statement.
ProgramB fly's right threw the first DB2 statement. The DB2 statement is the same in both programs.

When I remove NODYNAM and rerun ProgramA it runs successfully. When I put the NODYNAM back it crashes with -981 again.

Can anyone make suggestions to help me here ?

Thanks a million in advance.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Tue Feb 28, 2012 8:09 am
Reply with quote

how are you making the RRASF connection?
in both cases?
Back to top
View user's profile Send private message
anthonykitmcinnis

New User


Joined: 26 Feb 2012
Posts: 3
Location: Chicago

PostPosted: Tue Feb 28, 2012 8:55 am
Reply with quote

I am not certain.
After seeing the sqlcode description I searched RRASF and saw someone was connecting using the following inside a cobol program:

CALL 'DSNRLI' USING IDFYFN SSNM RIBTPR EIBPTR STARTECB RETCODE REASCODE.

CALL 'DSNRLI' USING SIGNONFUNC CORRID ACCTTKN ACCTINT
RETCODE REASCODE.

CALL 'DSNRLI' USING CREATETHREADFUNC PLAN COLLID REUSE RETCODE REASCODE.


I am not sure what these calls do however I do know that nothing like this is done inside my program.

Does that help ?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Tue Feb 28, 2012 9:14 am
Reply with quote

yes you are correct,
the code is used to connect to RRS.

so, does the module that runs ok CALL this cobol module that you found?

normally, a site is smart enough to create one module that is CALLed
to accomplish the connect.
your site apparently is not one.

if you are really interested in learning about RRS, the books found at this link will explain.

I would suggest that you mention to whoever is in charge of making important decisions at your site,
to create a CALLable module which makes the connect,
otherwise you will need to replicate the working-storage,
and the access of the plan, ssid, and other values required in making the connection
as well as the code to CALL the attachment facility and handle any error codes involved.

you are in a truly terrible situation with what appears to be dumb-ass managers.

either that, or you have not been listening to your lead programmers.

good luck.

by the way, for a price, i can provide a CALLable module.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Tue Feb 28, 2012 9:30 am
Reply with quote

by the way, what different resources is your program using?

db2
mqs
ims

??????
Back to top
View user's profile Send private message
anthonykitmcinnis

New User


Joined: 26 Feb 2012
Posts: 3
Location: Chicago

PostPosted: Tue Feb 28, 2012 10:09 am
Reply with quote

Both programs make a quick db2 select to make sure a date read from a file is properly formatted.

After that programB calls the putenv c program to set an env variable to create a dataset. ProgramB Then loops and write a timestamp to the new dynamically created dataset. This This program is compile nodynam.

ProgramA also makes a quick DB2 select to format a date also however it crashes on the -981 during this select. I am at a second job right now and cannot view the code at my day job however I am very certain nothing happens in this program accept db2 selects and sequential dataset writes.

ProgramA has to be compiled nodynam just like programB. I use the same compile and bind jcl for each. I use the same jcl to execute them.

When I get to my day job in the morning I will confirm that nothing is happening other than db2. I wrote so I am already certain of it though.

Does this help ?

Thanks so much for responding.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Tue Feb 28, 2012 10:22 am
Reply with quote

yes it does.

rrsaf is used when you use more than one resource (db2, mqs, ims,...)
since you are only using db2
you can make a simple CAF connection
(IKJEFT.., with a dsn parm)

though dynam and nodynam may affect your putenv bs,
it has no effect on the connect you make with db2.

i would suggest talking to your co-workers, lead programmers
as all this stuff is really, very basic.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Tue Feb 28, 2012 12:26 pm
Reply with quote

additional notes:

you are CALLing db2 with thru DSNRLI (rrsaf connection) instead of DSNALI (CAF interface)

this could be due to either
the TSO ATTACH parameter in you pre-compile
or pointing to the incorrect load library.

again,
you need to find out your site standards.
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 Replace each space in cobol string wi... COBOL Programming 3
No new posts Using API Gateway from CICS program CICS 0
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
Search our Forums:

Back to Top