# ACBX direct call interface used with C/C++

**URL:** <https://techcommunity.softwareag.com/t/acbx-direct-call-interface-used-with-c-c/197988>\
**Category:** Forum\
**Tags:** Adabas-Natural, Adabas, Adabas-Basics-on-Linux-Unix-Windows, Adabas-on-Windows-UNIX, Adabas-on-Linux\
**Created:** [February 2, 2018, 10:09am UTC](https://techcommunity.softwareag.com/t/acbx-direct-call-interface-used-with-c-c/197988 "2018-02-02T10:09:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thomas\_Esche](https://avatars.discourse-cdn.com/v4/letter/t/b19c9b/32.png) [@Thomas\_Esche](https://techcommunity.softwareag.com/u/Thomas_Esche)\
**Post date:** [February 2, 2018, 10:09am UTC](https://techcommunity.softwareag.com/t/acbx-direct-call-interface-used-with-c-c/197988/1 "2018-02-02T10:09:07Z")

</div>

Hi, I try to migrate older C programs from the ACB to the newer ACBX direct call interface. Unfortunately I could not found any sample code for C that make usage of the ACBX. Thus I tried to modify the c\_example.c example. But it seems that I could not manage to declare the ABD-list-pointer correctly. If I try to specify a record buffer the open command results in a response code 22. (note: without specifying a list-pointer the open command works).

\*\* Response code 22 (1013) from ADABAS for Command OP  
\*\* Additions2 32 32

Here is my routine:

```auto

int dbid; /* default database */
int emp_file; /* filenumber */
char openrb[100]; /* record buffer used for OPEN */
static ACBX cbx;	/* new control block */

int main(int argc, char **argv) {
	dbid = 12;
	emp_file = 9;

	if (open_database() != ADA_NORMAL) {
		response();
	} else {
		if (close_database() != ADA_NORMAL)
			response();
	}
}

int open_database() {
	ABD rb;
	PABD pABD[1];

	SETACBX(&cbx);
	cbx.acbxcmd[0] = 'O';
	cbx.acbxcmd[1] = 'P';

	SETABD(&rb);
	rb.abdid = ABDQRB;
	sprintf(openrb, "UPD=%d.", emp_file);
	rb.abdsize = strlen(openrb);
	rb.abdsend = rb.abdsize;
	rb.abdaddr = openrb;
	rb.abdloc = 'I';
	pABD[0] = &rb;

	do {
		cbx.acbxdbid = dbid;
		cbx.acbxfnr = 0;
		adabasx(&cbx, 1, pABD);
	} while (cbx.acbxrsp == ADA_TABT);

	cbx.acbxisq = 0;
	cbx.acbxisl = 0;

	return (cbx.acbxrsp);
}
```

Any help would be be greatly appreciated.  
Thomas

---

<div class="post-metadata">

**Author:** ![Thomas\_Esche](https://avatars.discourse-cdn.com/v4/letter/t/b19c9b/32.png) [@Thomas\_Esche](https://techcommunity.softwareag.com/u/Thomas_Esche)\
**Post date:** [February 2, 2018, 11:41am UTC](https://techcommunity.softwareag.com/t/acbx-direct-call-interface-used-with-c-c/197988/2 "2018-02-02T11:41:19Z")

</div>

Ok, now I get it. I had to specify a format buffer too. But that is strange since in the documention I read the following:

> [@](#):
>
> For commands where data in the record buffer is not described by a format specification in the format buffer, no format buffer segments need be specified; if any are specified, they are ignored. This applies to only a few commands; the most prominent of them is OP.

---

<div class="post-metadata">

**Author:** ![anon72918622](https://avatars.discourse-cdn.com/v4/letter/a/ecae2f/32.png) [@anon72918622](https://techcommunity.softwareag.com/u/anon72918622)\
**Post date:** [February 5, 2018, 10:04am UTC](https://techcommunity.softwareag.com/t/acbx-direct-call-interface-used-with-c-c/197988/3 "2018-02-05T10:04:11Z")

</div>

Hi Thomas,

Just for completeness, there is a C example using ACBX under Adabas-Client / examples / src .

Regards, Wolfgang

---

<div class="post-metadata">

**Author:** ![Thomas\_Esche](https://avatars.discourse-cdn.com/v4/letter/t/b19c9b/32.png) [@Thomas\_Esche](https://techcommunity.softwareag.com/u/Thomas_Esche)\
**Post date:** [February 5, 2018, 11:10am UTC](https://techcommunity.softwareag.com/t/acbx-direct-call-interface-used-with-c-c/197988/4 "2018-02-05T11:10:44Z")

</div>

Hi Wolfgang,  
thanks a lot. I must have been blind. You refer to the lob\_example.c, aren’t you?  
However, also there the open command is done with the conventional adabas function “adabas()” 🙂  
Nevertheless it is very useful. Thanks.  
Regards,  
Thomas

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [April 2, 2021, 3:40pm UTC](https://techcommunity.softwareag.com/t/acbx-direct-call-interface-used-with-c-c/197988/5 "2021-04-02T15:40:03Z")

</div>


