Dbstring()

From Recital Documentation Wiki
Revision as of 15:34, 1 May 2009 by Yvonnemilne (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

PURPOSE

format character string into a 'C' string


SYNOPSIS

#include "dbl.h"
 
	int	dbstring(charbuf, length, Cstringbuf)
 
	 <input parameters>
	char	*charbuf;		/* Address of a buffer containing string to be formatted */
	int	length;		/* Length of formatted string */
 
	<output parameter>
	char	*Cstringbuf;	/* Address of a buffer where the formatted string is placed by the function */


RETURN VALUE

This function has no return values.


DESCRIPTION

This function formats a string in 'charbuf' of length 'length' into a 'C' null terminated string. This function is only of use to 3GL programs written in languages other than 'C' which do not support null terminated strings.


EXAMPLE

This first example formats the string "John Smith".

#include "dbl.h"
 
	char	string[];	/* String buffer */
 
	dbstring("John Smith", 10, string);


The second, VMS/COBOL, example formats a string using dbstring() before calling The dbopen() function.

	INDENTIFICATION DIVISION.
	PROGRAM – ID.	COBOL_OPEN.
	.
	.
	.
	01	DATABASE_NAME		PIC	X(13).
	01	DBF_FD			PIC	9(09) COMP.
	01	RETURN_STAT		PIC	S9(04).
	.
	.
	.
	START-01
			CALL-DBOPEN.
			CALL "dbstring" USING BY
				VALUE "DATABASE.DBF"
				13
				REFERENCE DATABASE NAME.
			CALL "dbopen" USING BY
			CONTENT DATABASE_NAME
			REFERENCE DBF_FD
			GIVING RETURN_STAT
	.
	.
	.



SEE ALSO

dbatofld(), dbatokey(), dbstrcpy()