Skip to end of metadata
Go to start of metadata

Purpose

If you have an issue or errors with CT-library application this guide can help you find a resolution.

Overview

CT-library applications include $SYBASE/$SYBASE_OCS/bin and any application made with the libraries in $SYBASE/$SYBASE_OCS/lib.
 When running these applications you can debug the issue using CT_DEBUG routines:
 

CS_RETCODE ct_debug(context, connection, operation,flag, filename, fnamelen) 
 CS_CONTEXT           *context;
 CS_CONNECTION    *connection;
 CS_INT                      operation;
 CS_INT                      flag;
 CS_CHAR                  *filename;
 CS_INT                      fnamelen;

 Using CT_DEBUG you can set specific debug parameters to narrow down a specific issue.

 

CS_DBG_ALL

contextandconnection

Takes all possible debug actions.

CS_DBG_API_ LOGCALL

context

Prints out information each time the application calls a Client-Library routine, including the routine name and the parameter values.

CS_DBG_API_STATES

context

Prints information relating to Client-Library function-level state transitions.

CS_DBG_ASYNC

context

Prints function trace information each time an asynchronous function starts or completes.

CS_DBG_DIAG

connection

Prints message text whenever a Client-Library or server message is generated.

CS_DBG_ERROR

context

Prints trace information whenever a Client-Library error occurs. This allows a programmer to determine exactly where an error is occurring.

CS_DBG_MEM

context

Prints information relating to memory management.

CS_DBG_NETWORK

context

Prints information relating to Client-Library’s network interactions.

CS_DBG_PROTOCOL

connection

This ct_debug parameter may be set without devlib libraries. The parameter captures information exchanged with a server in protocol-specific (for example, TDS) format. This information is not human-readable.

CS_DBG_PROTOCOL_ FILE

connection

This ct_debug parameter may be set without devlib libraries. If the parameter is not set on connection, mktemp is called, generating a unique file name to dump the protocol packets into. The prefix string passed to mktemp is capture. The resulting protocol file is decodable by Ribo.

CS_DBG_PROTOCOL_ STATES

connection

Prints information relating to Client-Library protocol-level state transitions.

CS_DBG_SSL

connection

Allows a CT-Library application to write SSL-related diagnostics and error codes to standard output (stdout) or to a log file. This flag can be used in isql. CS_DBG_SSL can also be used with normal (non-debug) libraries.

CS_SET_FLAG

Supplied

NULL

Enables the subsystems specified by flag.

CS_CLEAR_FLAG

Supplied

NULL

Disables the subsystems specified by flag.

CS_SET_DBG_FILE

CS_UNUSED

Supplied

Records the name of the file to which it will write character-format debug information.

CS_SET_PROTOCOL_FILE

CS_UNUSED

Supplied

Records the name of the file to which it will write protocol-format debug information.

 

From http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc32840.1570/html/ctref/X74166.htm

 Example of building a ct-library application with debugging from sample exutils.c:

        /*
        ** ct_debug stuff. Enable this function on the connection if you
        ** want to write TDS information for debug purposes.
        */
        retcode = ct_debug(NULL, *connection, CS_SET_PROTOCOL_FILE, CS_UNUSED, "tds_log_file", CS_NULLTERM);
        if (retcode != CS_SUCCEED)
        {
               ex_error("ex_init: ct_debug PROTOCOL_FILE failed");
        }
        retcode = ct_debug(NULL, *connection, CS_SET_FLAG, CS_DBG_PROTOCOL, NULL, CS_UNUSED);
        if (retcode != CS_SUCCEED)
        {
                ex_error("ex_init: ct_debug CS_DBG_PROTOCOL failed");
        }

Environment Variables

You do not need to change your code to debug.  This can be done through environment variables as well.
SYBOCS_DEBUG_FLAGS–enables specific diagnostic subsystems. You can enable multiple debug options by specifying a comma-delimited list of flags in the variable.
SYBOCS_DEBUG_LOGFILE–specifies the log file where the diagnostics are recorded. If you do not set this variable, messages are written to stdout.

note

Debug flags that require devlib libraries still require devlib libraries even when using SYBOCS_DEBUG_LOGFILE. For information about which ct_debug flag parameters require devliblibraries, see above.

Unix Example:
cd $Sybase/OCS-16_0
mv lib  liborigrinal
cp devlib lib
setenv SYBOCS_DEBUG_FLAGS CS_DBG_SSL,CS_DBG_PROTOCOL
setenv SYBOCS_DEBUG_LOGFILE libsybfssl.log
./isql –U sa –P –S my_ssl_server
more libsybfssl.log

From http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc32840.1570/html/ctref/BGBBJJAE.htm

Windows Example:
rename the $SAP\OCS-16_0\dll directory to dll_original
copy the $SAP\OCS-16_0\dll\debug to the $SAP\OCS-16_0 directory
rename the $SAP\OCS-16_0\debug directory to dll
set the SYBOCS_DEBUG FLAGS and SYBOCS_DEBUG_LOGFILE as system environmental variables as above
Login as above with isql

Related Content

Related Documents

Related sap notes/kbas

  • No labels