Example: Using Standard Variables
This example illustrates the use of standard variables:
/**************************************************************** * Variable declarations **************************************************************/ ID idJDEDBResult = JDEDB_PASSED; ID idTableF0901 = ID_F0901; ID idIndexF0901 = ID_F0901_ACCOUNT_ID; ID idFetchCol[] = { ID_CO, ID_AID, ID_MCU, ID_OBJ, ID_SUB, ID_LDA, ID_CCT }; ushort usNumColToFetch = 7; ushort usNumOfKeys = 1; /*************************************************************** * Structure declarations ****************************************************************/ KEY3_F0901 dsF0901Key = {0} DSX51013_F0901 dsF0901 = {0} /*************************************************************** * Main Processing ***************************************************************/ /** Open the table, if it is not open **/ if ((*lpdsInfo->lphRequestF0901) == (HREQUEST) NULL) { if ( (*lpdsInfo->lphUser) == (HUSER) 0L ) { idJDEDBResult = JDB_InitBhvr ((void*)lpBhvrCom, &lpdsInfo->lphUser, (JCHAR *) NULL, JDEDB_COMMIT_AUTO); } if (idJDEDBResult == JDEDB_PASSED) { idJDEDBResult = JDB_OpenTable( (*lpdsInfo->lphUser), idTableF0901, idIndexF0901, (LPID)(idFetchCol), (ushort)(usNumColFetch), (JCHAR *) NULL, &lpdsInfo->hRequestF0901 ); } } /** Retrieve Account Master - AID only sent **/ if (idJDEDBResult == JDEDB_PASSED) { /** Set Key and Fetch Record **/ memset( (void *)(&dsF0901Key), (int) _J('\0'), sizeof(KEY3_F0901) ); jdeStrcpy ((char *) dsF0901Key.gmaid, (const JCHAR*) lpDS->szAccountID ); idJDEDBResult = JDB_FetchKeyed ( lpdsInfo->hRequestF0901, idIndexF0901, (void *)(&dsF0901Key), (short)(1), (void *)(&dsF0901), (int)(FALSE) ); /** Check for F0901 Record **/ if (eJDEDBResult == JDEDB_PASSED) { statement } }