DB2 SQL error 100

Ask question on - DataBase Concepts, IBM Mainframe DB2, DB2/UDB, DB2 Tools, SQL , DB2 programming with languages like COBOL, PL1.

Moderators: Kalicharan, Moderator Group

Post Reply
vincekumar
Member
Posts: 7
Joined: Tue Aug 04, 2009 8:13 pm

DB2 SQL error 100

Post by vincekumar » Tue Aug 04, 2009 9:06 pm

I am getting 'SQLCODE Return 000000100' in my batch program. When I do SPUFI I acn see the record but in batch I am not able to find the reocrd. Appreciate your answers. Thanks.
Vince

User avatar
Natarajan
Moderator
Posts: 537
Joined: Fri Oct 10, 2008 12:57 pm
Location: chennai
Contact:

Post by Natarajan » Wed Aug 05, 2009 12:30 pm

Interesting!!! :shock:

Can you post the query used in SPUFI & batch program?
Natarajan
Chennai

vincekumar
Member
Posts: 7
Joined: Tue Aug 04, 2009 8:13 pm

DB2 SQL error 100

Post by vincekumar » Wed Aug 05, 2009 7:27 pm

Natarajan wrote:Interesting!!! :shock:

Can you post the query used in SPUFI & batch program?
This is the query using in the batch:
EXEC SQL
SELECT MSTR_NAME
INTO :MSTR-NAME
FROM MASTER_FILE_TBL
WHERE MSTR_NAME = :MSTR-NAME
END-EXEC
DISPLAY 'OPENING MSTR CURSOR 1 = ' MSTR-NAME

In SPUFI:
SELECT *
FROM NASR.MASTER_FILE_TBL
WHERE MSTR_NAME = 'MAT.A0AZ7693.NDM.AZFIPR.DTBG11F1';

Thank you.
Vince

User avatar
Natarajan
Moderator
Posts: 537
Joined: Fri Oct 10, 2008 12:57 pm
Location: chennai
Contact:

Post by Natarajan » Wed Aug 05, 2009 8:53 pm

what value , you are populating to host variable :MSTR-NAME
Natarajan
Chennai

vincekumar
Member
Posts: 7
Joined: Tue Aug 04, 2009 8:13 pm

DB2 SQL error 100

Post by vincekumar » Wed Aug 05, 2009 11:47 pm

Whatever the value is in MSTR_NAME of the DB2 table should be populated in the MSTR-NAME in the host. What am I doing wrong here? Thanks.
Vince

User avatar
Natarajan
Moderator
Posts: 537
Joined: Fri Oct 10, 2008 12:57 pm
Location: chennai
Contact:

COBOL DB2 SELECT QUERY VS SPUFI

Post by Natarajan » Thu Aug 06, 2009 10:43 am

In SPUFI, you provided the value to the query.

Code: Select all

MSTR_NAME = 'MAT.A0AZ7693.NDM.AZFIPR.DTBG11F1'; 

In program also, you need to populate cobol host variable with this data, before
executing the query.

You should code the following before embedded sql in cobol..

Code: Select all

MOVE 'MAT.A0AZ7693.NDM.AZFIPR.DTBG11F1'   TO MSTR-NAME. 
Natarajan
Chennai

vincekumar
Member
Posts: 7
Joined: Tue Aug 04, 2009 8:13 pm

DB2 SQL error 100

Post by vincekumar » Thu Aug 06, 2009 7:18 pm

Thank you for your help. Much appreciated. It works now. I am getting another SQL error code of 00000030L. Does this have to do with the null values? Thanks.
Vince

User avatar
dbzTHEdinosauer
Moderator
Posts: 981
Joined: Mon Oct 02, 2006 8:31 pm

Post by dbzTHEdinosauer » Thu Aug 06, 2009 8:02 pm

-303 A VALUE CANNOT BE ASSIGNED TO
OUTPUT HOST VARIABLE NUMBER
position-number BECAUSE THE DATA
TYPES ARE NOT COMPARABLE

Code: Select all

********************************************************************** 
*  VALUES:                                                           * 
*      1 = A          -1 = J     EXAMPLES:  NUMBER    REPRESENTATION * 
*      2 = B          -2 = K                  10        00000001{    * 
*      3 = C          -3 = L                 105        00000010E    * 
*      4 = D          -4 = M                   0        00000000{    * 
*      5 = E          -5 = N                -234        00000023M    * 
*      6 = F          -6 = O                 -30        00000003}    * 
*      7 = G          -7 = P                                         * 
*      8 = H          -8 = Q                                         * 
*      9 = I          -9 = R                                         * 
*      0 = { ?        -0 = }  ?                                      * 
********************************************************************** 

Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.

vincekumar
Member
Posts: 7
Joined: Tue Aug 04, 2009 8:13 pm

DB2 SQL error 100

Post by vincekumar » Thu Aug 06, 2009 8:50 pm

Thank you for the reply. My code looks like:
EXEC SQL
FETCH MSTR-SWEEP-TBL-CSR
INTO
:MSTR-NAME,
:HV-NULL-FREQ,
:HV-NULL-IND,
:HV-NULL-JOB,
:HV-NULL-JUR,
:HV-NULL-LOB,
:MSTR-FAL-IND,
:MSTR-TRN-IND,
:MSTR-PRNT-IND,
:MSTR-APP-IND,
:MSTR-EDI-IND,
:MSTR-SECUR-IND
END-EXEC.

IF SQLCODE = 0
SET RECORD-FOUND TO TRUE

Do I need to change the host variables to the original names instead of :HV-NULL? Thanks.
Vince

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others