Example: Third-Party API

This example calls a third-party API named GetStateName that accepts a two-character state code and returns a 30-character state name:

/* Declare variables */
JCHAR  szStateCode[3] = _J("CO");  /* Unicode state code */
JCHAR  szStateName[31] = _J("\0");  /* Unicode state name */
ZCHAR  zzStateCode[3] = _Z("\0");  /* Non-Unicode state code */
ZCHAR  zzStateName[31] = _Z("\0");  /* Non-Unicode state name */
BOOL  bReturnStatus = FALSE;    /* API return flag */
/* Convert unicode strings to non-unicode strings */
jdeFromUnicode(zzStateCode, szStateCode, DIM(zzStateCode), NULL);
/* Call API */
bReturnStatus = GetStateName(zzStateCode, zzStateName);
/* Convert non-unicode strings to unicode strings for storage in
* JD Edwards EnterpriseOne */
jdeToUnicode(szStateName, zzStateName, DIM(szStateName), NULL);