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

Need help in solving S0C1 error while running Cobol-DB2 pgm


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

New User


Joined: 20 Jan 2004
Posts: 42

PostPosted: Fri May 15, 2009 12:34 pm
Reply with quote

Hi,

My cobol-DB2 program failed with S0C1 error on submission. I am pasting the error message that I got from Sysout. It fails as it come to first SQL statement in the program. Any help would be highly appreciated.
Thanks in advance.

IKJ56641I DSN ENDED DUE TO ERROR+
IKJ56641I SYSTEM ABEND CODE 0C1 REASON CODE 00000001

The system detected an operation exception (System Completion Code=0C1
From compile unit XXXXXX at entry point XXXXXXX at compile unit offse
at address 00000000.
Possible Bad Branch: Statement: Offset: +0000325E
Back to top
View user's profile Send private message
a027412

New User


Joined: 05 Jul 2007
Posts: 40
Location: Minneapolis, MN

PostPosted: Sat May 16, 2009 2:14 am
Reply with quote

I encountered same error some time back and this what i did.. removed the LINKPARM for the program.

Lemme know whether this is a BMC program?
Back to top
View user's profile Send private message
michaeltai
Warnings : 1

New User


Joined: 23 Jul 2005
Posts: 20

PostPosted: Mon Sep 07, 2009 8:25 am
Reply with quote

I'm getting the same error message when I was trying to run a Assembler program to SELECT data FROM a DB2 table. I've included DSNHLI in the LINK-EDIT step, and keep or discard 'NCAL' parm. But it doesn't help.
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 Sep 08, 2009 2:21 am
Reply with quote

Hello,

Quote:
at address 00000000.
Do you see this in your diagnostic info? Code should never try to branch to address zero. . .

Does your link edit have any unresolved references?

Does anyone else have a working assembler/db2 program? If yes, check how the 2 are different as to the db2 processing.
Back to top
View user's profile Send private message
michaeltai
Warnings : 1

New User


Joined: 23 Jul 2005
Posts: 20

PostPosted: Tue Sep 08, 2009 6:05 pm
Reply with quote

Code:

READY                                                     
  DSN SYSTEM(DSN1)                                         
DSN                                                       
  RUN PROGRAM(VCASMSQL) PLAN(EFSBP001)   LIB('TGF.MNS.LOD')
IKJ56641I DSN      ENDED DUE TO ERROR+                     
IKJ56641I SYSTEM ABEND CODE 0C1   REASON CODE 00000001     

1JOB VCASMSQL         STEP STEP001         TIME 200952   DATE 09251   
0COMPLETION CODE      SYSTEM = 0C1      REASON CODE = 00000001       
                                                                     
   PSW AT ENTRY TO ABEND   078D1000  0005B856  ILC  02  INTC  0001   
0PSW LOAD MODULE             ADDRESS = 0005B840  OFFSET = 00000016   
 NAME=VCASMSQL




dump
Code:

0005B840    90ECD00C 05C041E0 C38250ED 000850DE    000418DE 00000000 00000000 0000
0005B860    00000000 00000000 00000000 00000000    00000000 00000000 00000000 0000



Code:

  Active Usings: None                                                           
  Loc  Object Code    Addr1 Addr2  Stmt   Source Statement                     
                                      1          MACRO                         
                                      2          SQLSECT &TYPE                 
                                      3          GBLC  &SQLSECT                 
                                      4          AIF ('&TYPE' EQ 'RESTORE').REST
                                      5 &SQLSECT SETC  '&SYSECT'               
                                      6          MEXIT                         
                                      7 .REST    ANOP                           
                                      8 &SQLSECT CSECT                         
                                      9          MEND                           
000000                00000 004BC    10 VCASMSQL CSECT                         
                                     11          SAVE  (14,12)                 
000000                               13+         DS    0H                       
000000 90EC D00C            0000C    14+         STM   14,12,12(13)             
000004 05C0                          15          BALR  12,0                     
                 R:C  00006          16          USING BASEPT,12               
000006                               17 BASEPT   DS    0H                       
000006 41E0 C382            00388    18          LA    14,SAVEAREA             
00000A 50ED 0008            00008    19          ST    14,8(13)                 
00000E 50DE 0004            00004    20          ST    13,4(14)                 
000012 18DE                          21          LR    13,14                   
                                     22 ***$$$                                 
                                     23 *        EXEC SQL BEGIN DECLARE SECTION
                                     24 ***$$$                                 
000014                               25 CODEIDX  DS    CL15                     
000023                               26 CODEVAL  DS    CL20                     


OFFSET of next instruction is 16 which seems to be within CODEIDX DS CL15, it's very strange


Code:

SECTION    CLASS                                      ------- SOURCE --------
 OFFSET   OFFSET  NAME                TYPE    LENGTH  DDNAME   SEQ  MEMBER   
                                                                             
               0  VCASMSQL           CSECT       4BC  SYSLIN    01  **NULL**
                                                                             
             4C0  DSNAA              CSECT       100  SYSLIB    03  DSNELI   
     E4      5A4     DS#AA              LABEL                               
     FC      5BC     DSNAA@             LABEL                               
                                                                             
             5C0  DSNELI             CSECT       200  SYSLIB    03  DSNELI   
     1C      5DC     DSNWLI             LABEL                               
     2C      5EC     DSNHLI             LABEL                               
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: Tue Sep 08, 2009 6:09 pm
Reply with quote

I don't do SQL but I can tell you the Assembler will cause abends about 100% of the time. Your code does the LR 13,14 and then immediately executes data -- a sure-fire recipe for abends. Either the SQL data definition needs a DSECT or it needs to be moved after the LTORG or something -- but the way you've got it coded the assembler will abend unless by some wild chance your data happens to represent valid assembler instructions -- in which case, who knows what will result?
Back to top
View user's profile Send private message
michaeltai
Warnings : 1

New User


Joined: 23 Jul 2005
Posts: 20

PostPosted: Tue Sep 08, 2009 6:36 pm
Reply with quote

I once thought DB2 will automaticall put the variables it uses in a DSECT - SQLDSECT, Since I include the EXEC SQL BEGIN DECLARE SECTION

And I searched a sample on the web.

I didn't see it explicitly put the DS under a DSECT
Code:

SQL Functions performed out of Assembler-Source


         TITLE ' S Q L   F U N K T I O N E N                          ' DTA11040
*********************************************************************** DTA11050
*  SQL   HAUPTMODUL SQL FUNKTIONEN                                    * DTA11060
*********************************************************************** DTA11070
SQL      DS    0H                                                       DTA37260
         USING *,11                                                     DTA37260
         SAVE  (14,12)
         LR    11,15
         ST    R13,SQSAVR13
         ST    R13,SAVESQL+4
         LA    R13,SAVESQL
         MVC   FZ1A2,=C'SQL '                                           DTA37270
*        WTO   ' DTA02  EINGANG SQL'
*---------------------------------------------------------------------
         L     R8,SQLSAVR8             RESTORE SQLDSECT BASIS
         USING SQLDSECT,R8                                              DTA37260
*---------------------------------------------------------------------
*
         CLC   SQFUNK,=C'GETVIS'       GETVIS
         BE    A05
         CLC   SQFUNK,=C'OPENC1'       DECLARE / OPEN CURSOR
         BE    O10
         CLC   SQFUNK,=C'GETSEQ'       LESEN SEQUENTIELL
         BE    S10
         CLC   SQFUNK,=C'UPDATE'       UPDATE A-SATZ
         BE    U20
         CLC   SQFUNK,=C'CLOSC1'       CLOSE CURSOR
         BE    C10
*
         B     SQEND
*--------------------------------------------------------------------*  KO008990
*        S Q L  -  D E F I N I T I O N E N     EXTERN                *  KO009000
*--------------------------------------------------------------------*  KO009010
D0       EQU   0                       ANLEGEN/LOESCH SQL/DS-GETVIS     KO009020
D1       EQU   1                       ANLEGEN/LOESCH SQL/DS-GETVIS     KO009030
         SPACE                                                          KO009040
FD100    DC    A(100)                  RETURN CODE SQL                  KO009050
CVDFLD   DC    D'0'                    FELD FUER CVD INSTRUKTION        KO009060
FESQL    DS    CL11                    FELD FUER SQL-FEHLER-CODE        KO009070
SQLSAVR8 DC    F'0'                    SAVE SQL-DSECT BASIS             KO009070
SQSAVR13 DC    F'0'                    SAVE R13 FUER SQL-FUNKTIONEN     DTA37250
SAVESQL  DC    18F'0'                  SQL SAVEAREA                     DTA37250
         SPACE                                                          KO009080
*--------------------------------------------------------------------*  KO008990
*        S Q L  -  D E F I N I T I O N E N     INTERN                *  KO009000
*--------------------------------------------------------------------*  KO008990
         EXEC SQL BEGIN DECLARE SECTION                                 KO000760
         SPACE                                                          KO000770
USERID   DS    CL8                                                      KO000780
PASSW    DS    CL8                                                      KO000790
         SPACE                                                          KO000800
DTKTONRA DS    CL8                     SPEICHER A-SATZ FUER UPDATE
DTZEITA  DS    PL4
DTSAA    DS    CL1
*---------------------------------------------------------------------* KO001220
*        D T A  -  T A B                                         *----* KO001230
*---------------------------------------------------------------------* KO001240
         SPACE                                                          KO001250
DTKTONR  DS    CL8                                                      KO000840
DTZEIT   DS    PL04'9999'                                               KO001260
DTLFDNR  DS    PL03'999'                                                KO001270
DTSA     DS    CL01                                                     KO001280
DTDTA01  DS    CL150                                                    KO001290
DTDTA02  DS    CL250                                                    KO001290
DTDTA03  DS    CL204                                                    KO001290
         SPACE                                                          KO001300
*---------------------------------------------------------------------* KO001310
         EXEC SQL END DECLARE SECTION                                   KO001320
         EXEC SQL INCLUDE SQLCA                                         KO001330
*********************************************************************** DTA11050
*   A05   SQL GETVIS SPEICHER HOLEN                                   * DTA11060
*********************************************************************** DTA11070
A05      DS    0H                                                       DTA37250
         MVC   FZ1A3,=C'A05 '                                           DTA37270
*        WTO   ' DTA02  EINGANG A05'
*---------------------------------------------------------------------* KO002180
A05B     DS    0H                                                       KO002190
         L     R0,SQLDSIZ              R0:= LAENGE DSECT FUER SQL       KO002200
         GETVIS ADDRESS=(1),LENGTH=(0)                                  KO002210
         LTR   R15,R15                 PRUEFUNG, OB RETURN CODE         KO002220
         BZ    A05B1                   KEIN RETURN CODE                 KO002230
         MVC   FZ1A4(15),=CL15'INIT SQL-DSECT'                          KO002240
         B     ABEND                   DRUCKEN FEHLERMELDUNG/CANCEL     KO002250
A05B1    LR    R8,R1                   R8:= ADRESSE GETVIS BEREICH      KO002260
         USING SQLDSECT,R8             ADRESSIEREN                      KO002270
         LR    R9,R0                   R9:= LAENGE DES GETVIS BEREICH   KO002280
A05B2    MVI   D0(R1),X'00'            BEREICH LOESCHEN                 KO002290
         LA    R1,D1(R1)                                                KO002300
         BCT   R9,A05B2                SCHLEIFE                         KO002310
*-------------------------------------------------------------------*   KO002320
A05C     DS    0H                                                       KO002330
         MVC   PASSW,=CL8'SQLDBAPW'                                     KO002340
         MVC   USERID,=CL8'SQLDBA'                                      KO002350
         ST    R8,SQLSAVR8
*-------------------------------------------------------------------*   KO002360
A05D     DS    0H                                                       KO002370
         EXEC SQL WHENEVER SQLWARNING CONTINUE                          KO002380
         EXEC SQL WHENEVER SQLERROR GOTO Z90                            KO002390
         EXEC SQL WHENEVER NOT FOUND GOTO Z91                           KO002400
         EXEC SQL CONNECT :USERID IDENTIFIED BY :PASSW                  KO002410
*---------------------------------------------------------------------* DTA37320
A05Z     DS    0H                                                       DTA37330
         XC    FZ1A3,FZ1A3                                              DTA37340
*        WTO   ' DTA02  AUSGANG A05'
         B     SQEND
*********************************************************************** DTA05090
*   O10   OPEN UND DECLARE CURSOR SQL                                 * DTA05100
*********************************************************************** DTA05110
O10      DS    0H                                                       DTA05130
         MVC   FZ1A3,=C'O10 '                                           DTA05150
*        WTO   ' DTA02  EINGANG O10'
*---------------------------------------------------------------------* DTA05160
O10A     DS    0H                                                       KO003320
         MVC   DTKTONR,=C'00000000'                                     KO003330
         EXEC SQL DECLARE C1 CURSOR FOR                                *KO003340
                 SELECT DTKTONR,DTZEIT,DTLFDNR,DTSA,                   *KO003350
                        DTDTA01,DTDTA02,DTDTA03                        *KO003360
                 FROM DTATAB                                           *KO003410
                 WHERE DTKTONR>=:DTKTONR                                KO003420
         EXEC SQL OPEN C1                                               KO003430
*---------------------------------------------------------------------* DTA05250
O10Z     DS    0H                                                        DTA0526
         XC    FZ1A3,FZ1A3
*        WTO   ' DTA02  AUSGANG O10'
         B     SQEND                                                    DTA37360
*********************************************************************** DTA05090
*   U20   UPDATE SQL                                                  * DTA05100
*********************************************************************** DTA05110
         SPACE                                                          DTA05120
U20      DS    0H                                                       DTA05130
         MVC   FZ1A3,=C'U20 '                                           DTA05150
*        WTO   ' DTA02  EINGANG U20'
*
         MVI   STAVKZ,C'V'                  KZ- VERBUCHT
         MVC   DTDTA02,STASATZ              T8385-BEREICH IN A-SATZ
*
U20A     DS    0H                                                       KO003320
         EXEC SQL UPDATE DTATAB SET                                    *KO003340
                        DTDTA02 = :DTDTA02                             *KO003350
                 WHERE  DTKTONR = :DTKTONRA                            *KO003360
                 AND    DTZEIT  = :DTZEITA                             *KO003360
                 AND    DTSA    = :DTSAA                                KO003360
*                                                                       DTA05250
U20Z     DS    0H                                                        DTA0526
         XC    FZ1A3,FZ1A3
*        WTO   ' DTA02  AUSGANG U20'
         B     SQEND                                                    DTA37360
*********************************************************************** DTA05090
*   S10   LESEN SQL-EINGABE SEQ.                                      * DTA05100
*********************************************************************** DTA05110
         SPACE                                                          DTA05120
S10      DS    0H                                                       DTA05130
         MVC   FZ1A3,=C'S10 '                                           DTA05150
*        WTO   ' DTA02  EINGANG S10'
*---------------------------------------------------------------------* DTA05160
S10A     DS    0H                                                       KO003570
         EXEC SQL FETCH C1 INTO                                        *KO003580
                 :DTKTONR,:DTZEIT,:DTLFDNR,:DTSA,                      *KO003590
                 :DTDTA01,:DTDTA02,:DTDTA03                             KO003600
S10A1    DS    0H                                                       KO003650
         CLC   SQLCODE,FD100                                            KO003660
         BE    SQLEOF                                                   KO003670
*                                                                       DTA05160
         MVC   TBER+000(008),DTKTONR        UEBERTRAGEN IN TBER
         MVC   TBER+008(004),DTZEIT
         MVC   TBER+012(003),DTLFDNR
         MVC   TBER+015(001),DTSA
         MVC   TBER+016(150),DTDTA01
         MVC   TBER+166(250),DTDTA02
         MVC   TBER+416(204),DTDTA03
*                                                                       DTA05250
         CLI   DTSA,C'A'
         BNE   S10Z
*
         MVC   DTKTONRA,DTKTONR             A-SATZ KEY SPEICHERN
         MVC   DTZEITA,DTZEIT               FUER UPDATE
         MVC   DTSAA,DTSA
*                                                                       DTA05250
         MVC   STASATZ,DTDTA02            A-SATZ KONTOLL-BEREICH TA385
*                                                                       DTA05250
S10Z     DS    0H                                                        DTA0526
         XC    FZ1A3,FZ1A3
*        WTO   ' DTA02  AUSGANG S10'
         B     SQEND                                                    DTA37360
*********************************************************************** KO003740
*   C10  CLOSE SQL CURSOR                                             * KO003750
*********************************************************************** KO003760
C10      DS    0H                                                       KO003770
         MVC   FZ1A3,=C'C10 '                                           DTA05150
*        WTO   ' DTA02  EINGANG C10'
*                                                                       KO003800
         EXEC SQL CLOSE C1                                              KO003820
*                                                                       KO003830
C10Z     DS    0H                                                       KO003840
         XC    FZ1A3,FZ1A3
*        WTO   ' DTA02  AUSGANG C10'
         B     SQEND                                                    DTA37360
*********************************************************************** KO008830
*   Z90  AUSGEBEN FEHLERMELDUNG SQL-ERROR                             * KO008840
*********************************************************************** KO008850
Z90      DS    0H                                                       KO003770
         MVC   FZ1A3,=C'Z90 '                                           DTA05150
*                                                                       KO008860
         L     R11,SQLCODE             REG 11 = ERROR-CODE              KO008870
         CVD   R11,CVDFLD              UMSETZEN SQLCODE IN DECIMAL      KO008880
         UNPK  FESQL,CVDFLD            ENTPACKEN IN AUSGABEFELD         KO008890
         OI    FESQL+10,X'F0'                                           KO008900
         MVC   FZ1A4(15),=CL15' '                                       KO008910
         MVC   FZ1A4(11),FESQL                                          KO008920
*                                                                       KO008860
         WTO   'DTA02   ACHTUNG SQL-FEHLER LAUT DUMP'
*                                                                       KO008860
         B     ABEND                                                    KO008930
*********************************************************************** KO008830
*   Z91  AUSGEBEN FEHLERMELDUNG SQL-NOTFOUND                          * KO008840
*********************************************************************** KO008850
Z91      DS    0H                                                       KO003770
         MVC   FZ1A3,=C'Z91 '                                           DTA05150
*                                                                       KO008860
         L     R11,SQLCODE             REG 11 = ERROR-CODE              KO008870
         CVD   R11,CVDFLD              UMSETZEN SQLCODE IN DECIMAL      KO008880
         UNPK  FESQL,CVDFLD            ENTPACKEN IN AUSGABEFELD         KO008890
         OI    FESQL+10,X'F0'                                           KO008900
         MVC   FZ1A4(15),=CL15' '                                       KO008910
         MVC   FZ1A4(11),FESQL                                          KO008920
*                                                                       KO008860
         WTO   'DTA02   ***  ACHTUNG SQL-FEHLER  ***'
*                                                                       KO008860
         B     ABEND                                                    KO008930
*********************************************************************** KO008830
*   SQEND    ENDE  DER SQL FUNKTION                                   * KO008840
*********************************************************************** KO008850
SQEND    DS    0H                                                       KO003770
         XC    FZ1A2,FZ1A2                                              KO003850
*        WTO   ' DTA02  AUSGANG SQL'
         DROP  R8
         L     R13,SQSAVR13                                             DTA37350
         RETURN (14,12)                                                 DTA37360
         SPACE                                                          DTA37460
*********************************************************************** DTA85650
*                                                                     * DTA85660
*            P R O G R A M M E N D E      D T A U S 2                 * DTA85670
*                                                                     * DTA85680
*---------------------------------------------------------------------* DTA85690
*                                                                     * DTA85700
*   CO.  MUSTERNN BANK FRANKFURT                                      * DTA85710
*        IM OKTOBER  2002                                             * DTA85720
*                                                                     * DTA85730
*                                                                     * DTA85750
*********************************************************************** DTA85760
         SPACE 5                                                        DTA85770
END      DS    0H                                                       DTA8578
         END   START                                                    DTA85790
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 Sep 08, 2009 7:35 pm
Reply with quote

Hello,

Quote:
And I searched a sample on the web.
One of the very first things to learn is that just because something is available on the web does not mean it is correct or suitable for your particular situration. . .

Until you personally have downloaded a "thing" and successfully used it in your envirpnment, it is at best just an experiment. . .

Some "things" are much better than others (like offerings from gsf, the cbt tape, etc).
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 Running REXX through JOB CLIST & REXX 13
No new posts Error to read log with rexx CLIST & REXX 11
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts Error when install DB2 DB2 2
Search our Forums:

Back to Top