How to Dump Memory in JDEDEBUG.log for Debugging/tracing Using jdeWriteLog and jdeTraceSz1 APIs

Purpose of Document

Are there any standard APIs available that can be used in debugging a certain business function?

 

NOTE:

Overview

Many times the online debugging may not be easy in debugging memory issue where jdedebug.log does not give you the value of variables used in a routine, some of standard JDE APIs can be used,

Available APIs,

 

 

jdeWriteLogEntry()

void jdeWriteLogEntry( LOGFILETYPE iLogType,
                       const JCHAR *module, /* Module making the entry, i.e. jdeFatal jdeKrnl etc. */
                       const ZCHAR *srcFile, /* source module name __FILE__ */
                       int srcLine, /* source module line __LINE__ */
                       int errNum, /* Msg text short */
                       const JCHAR *tempText /* Msg text description */
)
Example:


jdeWriteLogEntry(JDELOG, _J("jdeXML"), __FILE__, __LINE__, 0, _J("INITIALIZING XML SERVICE KERNEL"));

Back To Top

 

jdeVWriteLogEntry()

void jdeVWriteLogEntry( const JCHAR *module, /* Module making the entry, i.e. jdeFatal jdeKrnl etc. */
                        const ZCHAR *srcFile, /* source module name __FILE__ */
                        int srcLine, /* source module line __LINE__ */
                        int errNum, /* Msg text short */
                        const JCHAR *msgFormat, /* Msg format specifier */
                        ... /* optional parms for msgFormat */
)

Example:


b0000122 - PostToF0902 (F0902 Update Account Balance)
   jdeVWriteLogEntry(_J(""), __FILE__, __LINE__, 0,
                                 _J("F0902 Update Successful. Please Ignore Previous F0902 Insert Failure."));

Back To Top

 

jdeWriteLog ()

void jdeWriteLog( const JCHAR *module, /* Module making the entry */
                  int errNum, /* Msg text short */
                  const JCHAR *msgFormat, /* Msg format specifier */
)

Example:


b0000182 - jdeInitEnvBSFN (jdeInitEnvBSFN)
    jdeWriteLog(_J("B0000182"), 0,
                        _J("B0000182:IB0000182_InitializeQuantumSalesTax: CacheInit Failed for SalesTaxInit cache"));

Back To Top

 

jdeTraceSz1 ()

Prototype:

 

void jdeTraceSz1( NULL, /* Set this value Null */
                  const JCHAR *format, /* Error String with Dereferncing Error for next parameter */
                  ,... /* As many as you define de-referencing in * format */
)
Example 1 (De-reference number):

long                lNumber = 0 ; /* declare variable - declare this in the code block*/

MathNumericToLong(&lpDS->mnUnallowableAmtTot_EHGOVUNTOT, &lNumber); /* Convert JDE MathNumeric to Long */
jdeTraceSz1(NULL, _J("For Debug:F20111_FetchExpRptHeader : Value from ExpRpt Header is = (%ld)"), lNumber);

 

Note: in case above code does not write long integer value, try,

char                                szTempString[42]                = {0}; /* declare local variable */

FormatMathNumeric(szTempString, &lpDS->mnForAmtSelectedToMatch); /* in case you want to write mnForAmtSelectedToMatch */
jdeTraceSz1(NULL, "doseo 693 : %s", szTempString);    /* this is example of non unicode business function. e.g., B7 releases */

 

Example 2 (De-reference String):
jdeTraceSz1(NULL, _J("Before fetch %lc"),dsF0911Key1.gldct);
JDBReturn = JDB_FetchKeyed(hRequest1F0911,
        ID_F0911_DOC_TYPE__NUMBER,
        (void *)&dsF0911Key1, (short)7,
        (void *)&dsColF0911, (int)FALSE);
jdeTraceSz1(NULL, _J("After fetch %lc"),dsF0911Key1.gldct);

Back To Top

<Internal_Only> Our API documenation does not have API jdeTraceSz1 () information. But this API is the best one to implement to write/trace actual value in jdedebug.log. If you have prototype for this API, please put some comment in this document. </Internal_Only>