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

IMS/DB2/COBOL Insert question


IBM Mainframe Forums -> IMS DB/DC
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
DS
Warnings : 1

New User


Joined: 09 Jun 2005
Posts: 25
Location: Bangalore

PostPosted: Tue Aug 26, 2008 4:12 am
Reply with quote

Hi,

I am calling COBOL pgm from DB2 stored procedure. COBOL program should INSERT a row in DB2 table and later the same data has to be inserted in IMS database into a segment.

My program is compiled and binded successfully but not running. Its giving SOC4 error some times. When I try to Xpedite the program its giving Abend S806-04. I need some clarifications.

1. In what mode should I use for debugging? standard / IMS / MPP / BMP?
2. How to run this program?
3. Is there any standard compile JCL?

I have written a sample program with a INPUT file reading and INSERTin in to DB2 table. Up to this its working fine, afterwards I added IMS part. Its compiling good but not running properly. Appreciate any help in this regard.

Thanks & Regards,
DS.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Aug 26, 2008 4:49 am
Reply with quote

Hello,

When you have a question, you need to start a new topic for your question rather than reply to some existing topic.
Back to top
View user's profile Send private message
Sandy Zimmer

Active Member


Joined: 13 Jun 2007
Posts: 826
Location: Wilmington, DE

PostPosted: Tue Aug 26, 2008 7:58 pm
Reply with quote

Did you do a PSB?
Back to top
View user's profile Send private message
DS
Warnings : 1

New User


Joined: 09 Jun 2005
Posts: 25
Location: Bangalore

PostPosted: Wed Aug 27, 2008 10:43 pm
Reply with quote

Hi,

I do have a PSB. But I am trying schedule a PSB using 'AERTDLI' call.
When I try to initialize, its giving AIBRETRN code 260.

AIBRETRN is part of AIB declaration. Here is the brief about concept.

Java Cleint --> Calling DB2 stored proc --> calling COBOL program --> COBOL program first insert a row into DB2 table --> Next same data of row should be inserted into IMS segment.

I am trying to work IMS ODBA access to connect IMS databse from DB2 stored proc.

COBOL program name: COBOLTST
PSB Name: TSTPSB
PCB Name: TSTPCB60
----------------------------------------
WORKING-STORAGE SECTION.
01 PGM-COBOLTST PIC X(08) VALUE 'COBOLTST'.
.......
.......
***********************************************************
* DL/I FUNCTION CODES
***********************************************************

77 GET-UNIQUE PICTURE X(4) VALUE 'GU '.
77 GET-HOLD-UNIQUE PICTURE X(4) VALUE 'GHU '.
77 GET-NEXT PICTURE X(4) VALUE 'GN '.
77 GET-HOLD-NEXT PICTURE X(4) VALUE 'GHN '.
77 DLET PICTURE X(4) VALUE 'DLET'.
77 ISRT PICTURE X(04) VALUE 'ISRT'.
77 REPL PICTURE X(04) VALUE 'REPL'.
77 CIMS PIC X(04) VALUE 'CIMS'.

77 APSB PIC X(04) VALUE 'APSB'.
77 DPSB PIC X(04) VALUE 'DPSB'.

77 APSB-NAME PIC X(08) VALUE 'TSTPSB'.
77 DPCB-NAME PIC X(08) VALUE 'TSTPCB60'.

77 APPLNME2 PIC X(08) VALUE 'DFSTDB2P'.
77 VAIBID PIC X(08) VALUE 'DFSAIB '.
77 TDBCTLID PIC X(08) VALUE 'IMSG '.
77 TDBCTLALL PIC X(08) VALUE 'ALL '.
.......
.......
LINKAGE SECTION.

01 PARM1-CD-IN PIC X(05).
01 PARM2-ID-NBR-IN PIC X(07).
01 PARM3-CD-IN PIC X(07).

01 OUT-AIBRETRN PIC 9(09) USAGE BINARY.
01 OUT-AIBREASN PIC 9(09) USAGE BINARY.
01 SQL-RETURN-CD-OUT PIC S9(09) COMP.
01 SQL-ERRMSG-OUT.
49 SQL-ERRMSG-OUT-LEN PIC S9(04) COMP.
49 SQL-ERRMSG-OUT-TEXT PIC X(255).

01 DBPCB.
02 DBNAME PICTURE X(8).
02 SEG-LEVEL-NO PICTURE X(2).
02 DBSTATUS PICTURE XX.
02 FILLER PICTURE X(20).

********************************************
PROCEDURE DIVISION USING
PARM1-CD-IN
PARM2-ID-NBR-IN
PARM3-CD-IN
SQL-RETURN-CD-OUT
SQL-ERRMSG-OUT.

.......
.......
**********************************************
* A1100-INITIALIZE
**********************************************
A1100-INITIALIZE.
INITIALIZE AIB.
SET AIBRESA1 TO NULLS.
SET AIBRESA2 TO NULLS.
SET AIBRESA3 TO NULLS.
MOVE ZEROES TO AIBRETRN.
MOVE ZEROES TO AIBREASN.
MOVE VAIBID TO AIBID.
MOVE LENGTH OF AIB TO AIBLEN.
*DS MOVE LENGTH OF IOAREA
MOVE LENGTH OF TST02P-DB-TST0201-SEG-ROOT TO AIBOALEN.
MOVE SPACES TO AIBSFUNC.
*DS MOVE APSBNME TO AIBRSNM1.
MOVE APSB-NAME TO AIBRSNM1.
MOVE TDBCTLID TO AIBRSNM2.

CALL 'AERTDLI' USING APSB, AIB.

IF AIBRETRN NOT EQUAL ZEROES
MOVE AIBRETRN TO OUT-AIBRETRN
MOVE AIBREASN TO OUT-AIBREASN
*DS MOVE ZEROES TO PSQLCODE
MOVE ZEROES TO SQL-RETURN-CD-OUT
........
........

Tricky thing here is PGM-NAME is not same as PSB-NAME. Next no ENTRY statement NOR IMS IO-PCB, ALT-PCB, DB-PCB in PROCEDURE DIVISION and as well in LINKAGE SECTION. Only IN and OUT paramers and one DB-PCB.

First to schedule a PSB we're using APSB call then trying to INSERT/UPDATE data into IMS databse.

Here I am getting AIBRETRN code as 260 and if I try to go further its encouter SOC4 abend.

Appreciate any idea.

Thanks & Regards,
DS.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Sep 05, 2008 6:00 am
Reply with quote

Hello DS,

Please re-post your question about 'AERTDLI' - i deleted it by mistake.
Back to top
View user's profile Send private message
Vinay Srivastava

New User


Joined: 03 Dec 2011
Posts: 1
Location: INDIA

PostPosted: Sat Dec 03, 2011 12:23 pm
Reply with quote

Hi,

You are printing the Return code , try printing the reason code as well
for both return code and reason code combinations there are explanations
given in the below book.

Messages and Codes, Volume 4: IMS Component Codes

http://publib.boulder.ibm.com/infocenter/dzichelp/v2r2/topic/com.ibm.imsmsgs.doc.msgs/dfsmc4h7.pdf?noframes=true

Hope that helps!
Back to top
View user's profile Send private message
CyberKing

New User


Joined: 13 Sep 2007
Posts: 7
Location: Victoria,BC,Canada

PostPosted: Sat Mar 24, 2018 2:07 am
Reply with quote

That's true!
You need printing both the return code and reason code ( in decimal) . then lookup the manual can easily find the issue.

FYI: I've successfully implemented ODBA in PL/I however, it can access both IMS DB and DB2.
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 -> IMS DB/DC

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
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
No new posts Generate random number from range of ... COBOL Programming 3
Search our Forums:

Back to Top