Description: Get Column Value From F03012 By Passing Alias
Header&Source File:
/*****************************************************************************
* Header File: B5603012.h
*
* Description: GetColumnValuefromF03012 Header File
*
* History:
* Date Programmer SAR# - Description
* ---------- ---------- -------------------------------------------
* Author 26/09/16 Lokesh Vedium Unknown - Created
*
*
* Copyright (c) J.D. Edwards World Source Company, 1996
*
* This unpublished material is proprietary to J.D. Edwards World Source
* Company. All rights reserved. The methods and techniques described
* herein are considered trade secrets and/or confidential. Reproduction
* or distribution, in whole or in part, is forbidden except by express
* written permission of J.D. Edwards World Source Company.
****************************************************************************/
#ifndef __B5603012_H
#define __B5603012_H
/*****************************************************************************
* Table Header Inclusions
****************************************************************************/
#include <f03012.h>
/*****************************************************************************
* External Business Function Header Inclusions
****************************************************************************/
#include<b4700220.h>
/*****************************************************************************
* Global Definitions
****************************************************************************/
/*****************************************************************************
* Structure Definitions
****************************************************************************/
/*****************************************************************************
* DS Template Type Definitions
****************************************************************************/
/*****************************************
* TYPEDEF for Data Structure
* Template Name: GetColumnValuefromF03012
* Template ID: D5603012
* Generated: Mon Sep 26 20:32:27 2016
*
* DO NOT EDIT THE FOLLOWING TYPEDEF
* To make modifications, use the OneWorld Data Structure
* Tool to Generate a revised version, and paste from
* the clipboard.
*
**************************************/
#ifndef DATASTRUCTURE_D5603012
#define DATASTRUCTURE_D5603012
typedef struct tagDSD5603012
{
JCHAR szColumnName[11];
MATH_NUMERIC mnAddressNumber;
JCHAR szCompany[6];
JCHAR szColumnValue[37];
} DSD5603012, *LPDSD5603012;
#define IDERRszColumnName_1 1L
#define IDERRmnAddressNumber_2 2L
#define IDERRszCompany_3 3L
#define IDERRszColumnValue_4 4L
#endif
/*****************************************************************************
* Source Preprocessor Definitions
****************************************************************************/
#if defined (JDEBFRTN)
#undef JDEBFRTN
#endif
#if defined (WIN32)
#if defined (WIN32)
#define JDEBFRTN(r) __declspec(dllexport) r
#else
#define JDEBFRTN(r) __declspec(dllimport) r
#endif
#else
#define JDEBFRTN(r) r
#endif
/*****************************************************************************
* Business Function Prototypes
****************************************************************************/
JDEBFRTN (ID) JDEBFWINAPI GetColumnValuefromF03012 (LPBHVRCOM lpBhvrCom, LPVOID lpVoid, LPDSD5603012 lpDS);
/*****************************************************************************
* Internal Function Prototypes
****************************************************************************/
#endif /* __B5603012_H */
#include <jde.h>
#define b5603012_c
/*****************************************************************************
* Source File: b5603012
*
* Description: GetColumnValuefromF03012 Source File
*
* History:
* Date Programmer SAR# - Description
* ---------- ---------- -------------------------------------------
* Author 26/09/16 Lokesh Vedium Unknown - Created
*
* Copyright (c) J.D. Edwards World Source Company, 1996
*
* This unpublished material is proprietary to J.D. Edwards World Source Company.
* All rights reserved. The methods and techniques described herein are
* considered trade secrets and/or confidential. Reproduction or
* distribution, in whole or in part, is forbidden except by express
* written permission of J.D. Edwards World Source Company.
****************************************************************************/
/**************************************************************************
* Notes:
*
**************************************************************************/
#include <b5603012.h>
/**************************************************************************
* Business Function: GetColumnValuefromF03012
*
* Description: Get ColumnValue from F03012
*
* Parameters:
* LPBHVRCOM lpBhvrCom Business Function Communications
* LPVOID lpVoid Void Parameter - DO NOT USE!
* LPDSD560 lpDS Parameter Data Structure Pointer
*
*************************************************************************/
JDEBFRTN (ID) JDEBFWINAPI GetColumnValuefromF03012 (LPBHVRCOM lpBhvrCom, LPVOID lpVoid, LPDSD5603012 lpDS)
{
/************************************************************************
* Variable declarations
************************************************************************/
ID idReturnCode = ER_SUCCESS;
ID idJDBReturn = JDEDB_PASSED;
ID idSelectSuccess = ER_SUCCESS;
HUSER hUser = NULL;
NID szTable = {0};
int nNumSelect = 0;
ID idJDEDBResult = JDEDB_PASSED;
ID idJDEDBReturn = JDEDB_PASSED;
HREQUEST hRequestF03012=(HREQUEST)NULL;
ID idFetchResult = JDEDB_PASSED;
JCHAR cValue = _J('0');/*Temporary Character Value for Character Format */
JCHAR szTempCharValue[2]; /*Temporary Character Value for Character Format */
JCHAR szTemporaryValue[100]; /*Temporary Variable for String Format */
MATH_NUMERIC mnValue; /*Temporary Variable for Math Numeric Value */
JDEDATE jdValue; /*Temporary Variable for Date Format*/
JCHAR szFormatMask[] = _J("OSASR"); /* Format Mask for JDEDATE to string conversion*/
MATH_NUMERIC mnTempValue; /*Temporary Math Numeric Value for Integer Format*/
int iValue = 0; /*Temporary Integer Value for Integer Format*/
ID idValue = (ID)NULL;/*Temporary Variable for Long Integer Format */
long int iDataItemSize = 0;
int iDataType = 0;
int iValueSize = 36;/*Size of szAlphaValue */
short sNumberOfKeysF4101 = 6;
/************************************************************************
* Declare structures
************************************************************************/
DBREF zDbRef = { 0 };
KEY1_F03012 dsF03012Key;
F03012 dsF03012;
DSD4700220A dsGetDataDictionaryInfo;
/************************************************************************
* Declare pointers
************************************************************************/
LPVOID pVoid = (LPVOID)NULL;
LPCOLINFO lpCol;
/************************************************************************
* Check for NULL pointers
************************************************************************/
if ((lpBhvrCom == (LPBHVRCOM) NULL) ||
(lpVoid == (LPVOID) NULL) ||
(lpDS == (LPDSD5603012) NULL))
{
jdeErrorSet (lpBhvrCom, lpVoid, (ID) 0, _J("4363"), (LPVOID) NULL);
return ER_ERROR;
}
/************************************************************************
* Set pointers
************************************************************************/
/************************************************************************
* Main Processing
************************************************************************/
idJDBReturn = JDB_InitBhvr(lpBhvrCom, &hUser, (JCHAR *)NULL, JDEDB_COMMIT_AUTO);
if (idJDBReturn != JDEDB_PASSED)
{
jdeSetGBRError(lpBhvrCom, lpVoid, (ID) 0, _J("078S"));
idReturnCode = ER_ERROR;
}
memset ((void *) &dsGetDataDictionaryInfo,(int) (_J('\0')), sizeof(DSD4700220A));
memset((void *)&zDbRef, (int)_J('\0'), sizeof(zDbRef));
memset((void *)szTemporaryValue, (int)_J('\0'), sizeof(szTemporaryValue));
memset((void *)&mnValue, (int)_J('\0'), sizeof(MATH_NUMERIC));
memset((void *)(&jdValue),(int)(_J('\0')), sizeof(JDEDATE));
ZeroMathNumeric(&mnTempValue);
idJDEDBResult = JDB_OpenTable (hUser, NID_F03012,
ID_F03012_ADDRESS_COMPANY, NULL,
(ushort) 0, (JCHAR *) NULL, &hRequestF03012);
if (idJDBReturn != JDEDB_PASSED)
{
idReturnCode = ER_ERROR;
}
else
{
memset ((void *) &dsF03012Key,(int) (_J('\0')), sizeof(KEY1_F03012));
/* Load Keys */
MathCopy (&dsF03012Key.aian8, &lpDS->mnAddressNumber);
jdeStrcpy((JCHAR *)(dsF03012Key.aico),
(const JCHAR *)(lpDS->szCompany));
idFetchResult = JDB_FetchKeyed(hRequestF03012,ID_F03012_ADDRESS_COMPANY,
(void *)(&dsF03012Key),(short)2,
(void *)(&dsF03012), (int)(FALSE));
jdeNIDcpy( zDbRef.szDict , lpDS->szColumnName);
jdeNIDcpy( zDbRef.szTable , _J("F03012") );
zDbRef.idInstance = 0L;
pVoid = JDB_GetTableColValue( hRequestF03012, zDbRef );
if ( pVoid == (LPVOID)NULL )
{
idJDEDBReturn = JDEDB_FAILED;
idReturnCode = ER_ERROR;
goto FunctionCleanUp;
}
else
{
/*Get Data Type information about the DD Item representing the Column passed in*/
jdeStrcpy ((JCHAR *) dsGetDataDictionaryInfo.szDataItem,
(const JCHAR *) (lpDS->szColumnName));
idJDEDBReturn = jdeCallObject(_J("GetDataDictionaryInformation"),
NULL, lpBhvrCom, lpVoid,
&dsGetDataDictionaryInfo,
(CALLMAP *) NULL,(int) 0,
(JCHAR *) NULL, (JCHAR *) NULL,
(int) 0);
/* Convert Data Item Size to long integer */
MathNumericToInt(&dsGetDataDictionaryInfo.mnLength,
(LPINT)&iDataItemSize);
iDataItemSize = iDataItemSize * sizeof(JCHAR);
/* Get Data Type Values for correponding fields */
jdeSscanf(dsGetDataDictionaryInfo.szDataType,_J("%d"),&iDataType);
switch (iDataType)
{
case 1 : /* Character Value */
memcpy((void *)(&cValue), (const void *)pVoid,
sizeof (JCHAR));
/* Convert character to string */
szTempCharValue[0] = cValue;
szTempCharValue[1] = _J('\0');
jdeStrncpy((JCHAR *)lpDS->szColumnValue, (const JCHAR *)szTempCharValue,
iValueSize - 1);
break;
case 2 :
case 20 : /* String Value */
memcpy((void *)szTemporaryValue,
(const void *)pVoid, iDataItemSize);
jdeStrncpy((JCHAR *)lpDS->szColumnValue, (const JCHAR *)szTemporaryValue,
iValueSize - 1);
break;
case 7 : /* ID */
memcpy((void*)&idValue,
(const void *)pVoid, sizeof (ID));
/* Convert ID (a long integer) to math numeric and
* math numeric to string */
LongToMathNumeric(idValue, &mnTempValue);
FormatMathNumeric(lpDS->szColumnValue, &mnTempValue);
break;
case 9 : /* Math Numeric Value */
memcpy((void*)&mnValue,
(const void *)pVoid, sizeof(MATH_NUMERIC));
/* Convert Math Numeric value to string */
FormatMathNumeric((PJSTR)lpDS->szColumnValue,
(LPMATH_NUMERIC)&mnValue);
break;
case 11 : /* JDEDATE */
memcpy((void*)&jdValue,
(const void *)pVoid, sizeof(JDEDATE));
/* Convert JDEDATE to string */
FormatDate(lpDS->szColumnValue, &jdValue, szFormatMask);
break;
case 15 : /* Integer Value */
memcpy((void*)&iValue,
(const void *)pVoid, sizeof (int));
/* Convert integer to math numeric and
* math numeric to string */
IntToMathNumeric(iValue, &mnTempValue);
FormatMathNumeric(lpDS->szColumnValue, &mnTempValue);
break;
} /* End of the switch construct to get values */
} /* End if pVoid is not NULL */
}
FunctionCleanUp:
/************************************************************************
* Function Clean Up
************************************************************************/
JDB_FreeBhvr(hUser);
if (hRequestF03012 != (HREQUEST)NULL)
{
JDB_CloseTable(hRequestF03012);
}
return (ER_SUCCESS);
}
/* Internal function comment block */
/**************************************************************************
* Function: Ixxxxxxx_a // Replace "xxxxxxx" with source file number
* // and "a" with the function name
* Notes:
*
* Returns:
*
* Parameters:
**************************************************************************/
Header&Source File:
/*****************************************************************************
* Header File: B5603012.h
*
* Description: GetColumnValuefromF03012 Header File
*
* History:
* Date Programmer SAR# - Description
* ---------- ---------- -------------------------------------------
* Author 26/09/16 Lokesh Vedium Unknown - Created
*
*
* Copyright (c) J.D. Edwards World Source Company, 1996
*
* This unpublished material is proprietary to J.D. Edwards World Source
* Company. All rights reserved. The methods and techniques described
* herein are considered trade secrets and/or confidential. Reproduction
* or distribution, in whole or in part, is forbidden except by express
* written permission of J.D. Edwards World Source Company.
****************************************************************************/
#ifndef __B5603012_H
#define __B5603012_H
/*****************************************************************************
* Table Header Inclusions
****************************************************************************/
#include <f03012.h>
/*****************************************************************************
* External Business Function Header Inclusions
****************************************************************************/
#include<b4700220.h>
/*****************************************************************************
* Global Definitions
****************************************************************************/
/*****************************************************************************
* Structure Definitions
****************************************************************************/
/*****************************************************************************
* DS Template Type Definitions
****************************************************************************/
/*****************************************
* TYPEDEF for Data Structure
* Template Name: GetColumnValuefromF03012
* Template ID: D5603012
* Generated: Mon Sep 26 20:32:27 2016
*
* DO NOT EDIT THE FOLLOWING TYPEDEF
* To make modifications, use the OneWorld Data Structure
* Tool to Generate a revised version, and paste from
* the clipboard.
*
**************************************/
#ifndef DATASTRUCTURE_D5603012
#define DATASTRUCTURE_D5603012
typedef struct tagDSD5603012
{
JCHAR szColumnName[11];
MATH_NUMERIC mnAddressNumber;
JCHAR szCompany[6];
JCHAR szColumnValue[37];
} DSD5603012, *LPDSD5603012;
#define IDERRszColumnName_1 1L
#define IDERRmnAddressNumber_2 2L
#define IDERRszCompany_3 3L
#define IDERRszColumnValue_4 4L
#endif
/*****************************************************************************
* Source Preprocessor Definitions
****************************************************************************/
#if defined (JDEBFRTN)
#undef JDEBFRTN
#endif
#if defined (WIN32)
#if defined (WIN32)
#define JDEBFRTN(r) __declspec(dllexport) r
#else
#define JDEBFRTN(r) __declspec(dllimport) r
#endif
#else
#define JDEBFRTN(r) r
#endif
/*****************************************************************************
* Business Function Prototypes
****************************************************************************/
JDEBFRTN (ID) JDEBFWINAPI GetColumnValuefromF03012 (LPBHVRCOM lpBhvrCom, LPVOID lpVoid, LPDSD5603012 lpDS);
/*****************************************************************************
* Internal Function Prototypes
****************************************************************************/
#endif /* __B5603012_H */
#include <jde.h>
#define b5603012_c
/*****************************************************************************
* Source File: b5603012
*
* Description: GetColumnValuefromF03012 Source File
*
* History:
* Date Programmer SAR# - Description
* ---------- ---------- -------------------------------------------
* Author 26/09/16 Lokesh Vedium Unknown - Created
*
* Copyright (c) J.D. Edwards World Source Company, 1996
*
* This unpublished material is proprietary to J.D. Edwards World Source Company.
* All rights reserved. The methods and techniques described herein are
* considered trade secrets and/or confidential. Reproduction or
* distribution, in whole or in part, is forbidden except by express
* written permission of J.D. Edwards World Source Company.
****************************************************************************/
/**************************************************************************
* Notes:
*
**************************************************************************/
#include <b5603012.h>
/**************************************************************************
* Business Function: GetColumnValuefromF03012
*
* Description: Get ColumnValue from F03012
*
* Parameters:
* LPBHVRCOM lpBhvrCom Business Function Communications
* LPVOID lpVoid Void Parameter - DO NOT USE!
* LPDSD560 lpDS Parameter Data Structure Pointer
*
*************************************************************************/
JDEBFRTN (ID) JDEBFWINAPI GetColumnValuefromF03012 (LPBHVRCOM lpBhvrCom, LPVOID lpVoid, LPDSD5603012 lpDS)
{
/************************************************************************
* Variable declarations
************************************************************************/
ID idReturnCode = ER_SUCCESS;
ID idJDBReturn = JDEDB_PASSED;
ID idSelectSuccess = ER_SUCCESS;
HUSER hUser = NULL;
NID szTable = {0};
int nNumSelect = 0;
ID idJDEDBResult = JDEDB_PASSED;
ID idJDEDBReturn = JDEDB_PASSED;
HREQUEST hRequestF03012=(HREQUEST)NULL;
ID idFetchResult = JDEDB_PASSED;
JCHAR cValue = _J('0');/*Temporary Character Value for Character Format */
JCHAR szTempCharValue[2]; /*Temporary Character Value for Character Format */
JCHAR szTemporaryValue[100]; /*Temporary Variable for String Format */
MATH_NUMERIC mnValue; /*Temporary Variable for Math Numeric Value */
JDEDATE jdValue; /*Temporary Variable for Date Format*/
JCHAR szFormatMask[] = _J("OSASR"); /* Format Mask for JDEDATE to string conversion*/
MATH_NUMERIC mnTempValue; /*Temporary Math Numeric Value for Integer Format*/
int iValue = 0; /*Temporary Integer Value for Integer Format*/
ID idValue = (ID)NULL;/*Temporary Variable for Long Integer Format */
long int iDataItemSize = 0;
int iDataType = 0;
int iValueSize = 36;/*Size of szAlphaValue */
short sNumberOfKeysF4101 = 6;
/************************************************************************
* Declare structures
************************************************************************/
DBREF zDbRef = { 0 };
KEY1_F03012 dsF03012Key;
F03012 dsF03012;
DSD4700220A dsGetDataDictionaryInfo;
/************************************************************************
* Declare pointers
************************************************************************/
LPVOID pVoid = (LPVOID)NULL;
LPCOLINFO lpCol;
/************************************************************************
* Check for NULL pointers
************************************************************************/
if ((lpBhvrCom == (LPBHVRCOM) NULL) ||
(lpVoid == (LPVOID) NULL) ||
(lpDS == (LPDSD5603012) NULL))
{
jdeErrorSet (lpBhvrCom, lpVoid, (ID) 0, _J("4363"), (LPVOID) NULL);
return ER_ERROR;
}
/************************************************************************
* Set pointers
************************************************************************/
/************************************************************************
* Main Processing
************************************************************************/
idJDBReturn = JDB_InitBhvr(lpBhvrCom, &hUser, (JCHAR *)NULL, JDEDB_COMMIT_AUTO);
if (idJDBReturn != JDEDB_PASSED)
{
jdeSetGBRError(lpBhvrCom, lpVoid, (ID) 0, _J("078S"));
idReturnCode = ER_ERROR;
}
memset ((void *) &dsGetDataDictionaryInfo,(int) (_J('\0')), sizeof(DSD4700220A));
memset((void *)&zDbRef, (int)_J('\0'), sizeof(zDbRef));
memset((void *)szTemporaryValue, (int)_J('\0'), sizeof(szTemporaryValue));
memset((void *)&mnValue, (int)_J('\0'), sizeof(MATH_NUMERIC));
memset((void *)(&jdValue),(int)(_J('\0')), sizeof(JDEDATE));
ZeroMathNumeric(&mnTempValue);
idJDEDBResult = JDB_OpenTable (hUser, NID_F03012,
ID_F03012_ADDRESS_COMPANY, NULL,
(ushort) 0, (JCHAR *) NULL, &hRequestF03012);
if (idJDBReturn != JDEDB_PASSED)
{
idReturnCode = ER_ERROR;
}
else
{
memset ((void *) &dsF03012Key,(int) (_J('\0')), sizeof(KEY1_F03012));
/* Load Keys */
MathCopy (&dsF03012Key.aian8, &lpDS->mnAddressNumber);
jdeStrcpy((JCHAR *)(dsF03012Key.aico),
(const JCHAR *)(lpDS->szCompany));
idFetchResult = JDB_FetchKeyed(hRequestF03012,ID_F03012_ADDRESS_COMPANY,
(void *)(&dsF03012Key),(short)2,
(void *)(&dsF03012), (int)(FALSE));
jdeNIDcpy( zDbRef.szDict , lpDS->szColumnName);
jdeNIDcpy( zDbRef.szTable , _J("F03012") );
zDbRef.idInstance = 0L;
pVoid = JDB_GetTableColValue( hRequestF03012, zDbRef );
if ( pVoid == (LPVOID)NULL )
{
idJDEDBReturn = JDEDB_FAILED;
idReturnCode = ER_ERROR;
goto FunctionCleanUp;
}
else
{
/*Get Data Type information about the DD Item representing the Column passed in*/
jdeStrcpy ((JCHAR *) dsGetDataDictionaryInfo.szDataItem,
(const JCHAR *) (lpDS->szColumnName));
idJDEDBReturn = jdeCallObject(_J("GetDataDictionaryInformation"),
NULL, lpBhvrCom, lpVoid,
&dsGetDataDictionaryInfo,
(CALLMAP *) NULL,(int) 0,
(JCHAR *) NULL, (JCHAR *) NULL,
(int) 0);
/* Convert Data Item Size to long integer */
MathNumericToInt(&dsGetDataDictionaryInfo.mnLength,
(LPINT)&iDataItemSize);
iDataItemSize = iDataItemSize * sizeof(JCHAR);
/* Get Data Type Values for correponding fields */
jdeSscanf(dsGetDataDictionaryInfo.szDataType,_J("%d"),&iDataType);
switch (iDataType)
{
case 1 : /* Character Value */
memcpy((void *)(&cValue), (const void *)pVoid,
sizeof (JCHAR));
/* Convert character to string */
szTempCharValue[0] = cValue;
szTempCharValue[1] = _J('\0');
jdeStrncpy((JCHAR *)lpDS->szColumnValue, (const JCHAR *)szTempCharValue,
iValueSize - 1);
break;
case 2 :
case 20 : /* String Value */
memcpy((void *)szTemporaryValue,
(const void *)pVoid, iDataItemSize);
jdeStrncpy((JCHAR *)lpDS->szColumnValue, (const JCHAR *)szTemporaryValue,
iValueSize - 1);
break;
case 7 : /* ID */
memcpy((void*)&idValue,
(const void *)pVoid, sizeof (ID));
/* Convert ID (a long integer) to math numeric and
* math numeric to string */
LongToMathNumeric(idValue, &mnTempValue);
FormatMathNumeric(lpDS->szColumnValue, &mnTempValue);
break;
case 9 : /* Math Numeric Value */
memcpy((void*)&mnValue,
(const void *)pVoid, sizeof(MATH_NUMERIC));
/* Convert Math Numeric value to string */
FormatMathNumeric((PJSTR)lpDS->szColumnValue,
(LPMATH_NUMERIC)&mnValue);
break;
case 11 : /* JDEDATE */
memcpy((void*)&jdValue,
(const void *)pVoid, sizeof(JDEDATE));
/* Convert JDEDATE to string */
FormatDate(lpDS->szColumnValue, &jdValue, szFormatMask);
break;
case 15 : /* Integer Value */
memcpy((void*)&iValue,
(const void *)pVoid, sizeof (int));
/* Convert integer to math numeric and
* math numeric to string */
IntToMathNumeric(iValue, &mnTempValue);
FormatMathNumeric(lpDS->szColumnValue, &mnTempValue);
break;
} /* End of the switch construct to get values */
} /* End if pVoid is not NULL */
}
FunctionCleanUp:
/************************************************************************
* Function Clean Up
************************************************************************/
JDB_FreeBhvr(hUser);
if (hRequestF03012 != (HREQUEST)NULL)
{
JDB_CloseTable(hRequestF03012);
}
return (ER_SUCCESS);
}
/* Internal function comment block */
/**************************************************************************
* Function: Ixxxxxxx_a // Replace "xxxxxxx" with source file number
* // and "a" with the function name
* Notes:
*
* Returns:
*
* Parameters:
**************************************************************************/
No comments:
Post a Comment