ACBX direct call interface used with C/C++

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:


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

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:

Hi Thomas,

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

Regards, Wolfgang

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()” :slight_smile:
Nevertheless it is very useful. Thanks.
Regards,
Thomas