HI,
I am getting the SQLCODE as -305. how i can handle the sqlcode -305
please help me
Thanks & Regrads,
Mit's
How to handle the null indiactor
Moderators: Kalicharan, Moderator Group
-
- Member
- Posts: 8
- Joined: Mon Feb 27, 2006 4:31 pm
- Location: India
sql code -305 , Use null indiactor in db2
Hi,
If you get -305 sqlcode which means you got null values into the host variables.
Solution -
Use NULL INDICATOR VARIABLES to stop getting -305.
Example
-----------
,: FIRST-NAME :WS-FIRST-NAME-NULL-IND
,: INIT-NAME :WS-MID-NAME-NULL-IND
FROM EMPLOYEE ........
Define Null Indicator variables as follows
05 WS-FIRST-NAME-NULL-IND PIC S9(04) COMP.
Use following logic When SQLCODE = 0.
IF WS-FIRST-NAME-NULL-IND >= 0
... Means Field populated with proper value
ELSE
... Means Field populated with null value
END-IF
In sum cases, I would suggest handle -305 instead of using
null indicator variables. If you are feching only one field, in that
case better go and handle -305, if query hit -305 move space/zero's
into host variable.
Thanks,
Krishna
If you get -305 sqlcode which means you got null values into the host variables.
Solution -
Use NULL INDICATOR VARIABLES to stop getting -305.
Example
-----------
,: FIRST-NAME :WS-FIRST-NAME-NULL-IND
,: INIT-NAME :WS-MID-NAME-NULL-IND
FROM EMPLOYEE ........
Define Null Indicator variables as follows
05 WS-FIRST-NAME-NULL-IND PIC S9(04) COMP.
Use following logic When SQLCODE = 0.
IF WS-FIRST-NAME-NULL-IND >= 0
... Means Field populated with proper value
ELSE
... Means Field populated with null value
END-IF
In sum cases, I would suggest handle -305 instead of using
null indicator variables. If you are feching only one field, in that
case better go and handle -305, if query hit -305 move space/zero's
into host variable.
Thanks,
Krishna
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
- Cobol Interview Questions
50+ Interview Questions - JCL Interview Questions
50+ Interview Questions - DB2 Interview Questions
100+ Interview Questions - CICS Interview Questions
70+ Interview Questions - VSAM Interview Questions
27 Interview Questions
Other References
Mainframe Tools and others
- XPEDITER Reference
Explains how we can debug a program - FILEAID Reference
Explains how to browse , edit and delete datasets - Change Man Reference
Quick Start tutorial on Changeman - Abend Reference
Important Abend codes explained - FaceBook Page
MainframeGurukul FaceBook Page - LinkedIn Page
MainframeGurkul Linkedin Page