---
title: "COBOL – SQLCA is Not Mandatory- Why"
description: "SQLCA -  Also called SQL communication is area, is not mandatory in COBOL Program. 01 SQLCA. 05 SQLCAID PIC X(8). 05 SQLCABC PIC S9(9) BINARY. 05 SQLCODE PIC S9(9) BINARY. 05 SQLERRM. 49 SQLERRML PIC..."
url: https://srinimf.com/2014/09/08/cobol-sqlca-is-not-mandatory-why/
date: 2014-09-08
modified: 2026-10-10
author: "Srini"
categories: ["COBOL"]
tags: ["COBOL SQLCA", "COBOL Tips and Tricks"]
type: post
lang: en
---

# COBOL – SQLCA is Not Mandatory- Why

SQLCA –  Also called SQL communication is area, [is not mandatory](https://srinimf.com/2016/02/21/how-to-get-sqlcode-in-db2-cobol-program-without-sqlca/) in COBOL Program.

01 SQLCA.
05 SQLCAID PIC X(8).
05 SQLCABC PIC S9(9) BINARY.
05 SQLCODE PIC S9(9) BINARY.
05 SQLERRM.
49 SQLERRML PIC S9(4) BINARY.
49 SQLERRMC PIC X(70).
05 SQLERRP PIC X(8).
05 SQLERRD OCCURS 6 TIMES
PIC S9(9) BINARY.
05 SQLWARN.
10 SQLWARN0 PIC X(1).
10 SQLWARN1 PIC X(1).
10 SQLWARN2 PIC X(1).
10 SQLWARN3 PIC X(1).
10 SQLWARN4 PIC X(1).
10 SQLWARN5 PIC X(1).
10 SQLWARN6 PIC X(1).
10 SQLWARN7 PIC X(1).
10 SQLWARN8 PIC X(1).
10 SQLWARN9 PIC X(1).
10 SQLWARNA PIC X(1).
05 SQLSTATE PIC X(5).

**The other way we can write as :**

```
EXEC SQL BEGIN DECLARE SECTION END-EXEC.
    01 SQLSTATE PIC X(5). 
    01 SQLCODE  PIC S9(9) USAGE COMP. 
    .
    .
    .
    EXEC SQL END DECLARE SECTION END-EXEC.
```

### Share this:

-
- [Tweet](https://twitter.com/share)
- [![](https://i0.wp.com/assets.pinterest.com/images/pidgets/pinit_fg_en_rect_gray_20.png)](https://www.pinterest.com/pin/create/link/?url=https%3A%2F%2Fsrinimf.com%2F2014%2F09%2F08%2Fcobol-sqlca-is-not-mandatory-why%2F&media=https%3A%2F%2Fi0.wp.com%2Fsrinimf.com%2Fwp-content%2Fuploads%2F2026%2F02%2Fcropped-logo.png%3Ffit%3D96%252C96%26ssl%3D1&description=COBOL%20-%20SQLCA%20is%20Not%20Mandatory-%20Why)
-
- [Share on Tumblr](https://www.tumblr.com/share)
- [Share on WhatsApp (Opens in new window) WhatsApp](https://srinimf.com/2014/09/08/cobol-sqlca-is-not-mandatory-why/?share=jetpack-whatsapp)
- [More](#)
-

- [Print (Opens in new window) Print](https://srinimf.com/2014/09/08/cobol-sqlca-is-not-mandatory-why/?share=print)
- [Share on Reddit (Opens in new window) Reddit](https://srinimf.com/2014/09/08/cobol-sqlca-is-not-mandatory-why/?share=reddit)
- [Share on Telegram (Opens in new window) Telegram](https://srinimf.com/2014/09/08/cobol-sqlca-is-not-mandatory-why/?share=telegram)
- [Email a link to a friend (Opens in new window) Email](mailto:?subject=%5BShared%20Post%5D%20COBOL%20-%20SQLCA%20is%20Not%20Mandatory-%20Why&body=https%3A%2F%2Fsrinimf.com%2F2014%2F09%2F08%2Fcobol-sqlca-is-not-mandatory-why%2F&share=email)
-

### Like this:

Like Loading…
