jdesmm
Well Known Member
I am attempting to emulate the main functionality in a base JDE C business function within my own C business function. The only thing I really need to change from the original BSFN is which fields it updates in a table. The particular function I'm referencing is the F4211PostEditLine (B4203200). I created a new data structure and then a new C BSFN. I then copied relevant sections of the original C BSFN code into my new BSFN, changing parameter names as necessary.
Now, I'm not a C programmer and usually do most of my development in JDE with the base toolset and NER when a function is needed. I had a couple of C classes back in college, but that was a long time ago. I'd say I know enough to understand the processing that occurs in C code when I read it, but not enough to be sure of proper syntax, structure, commands, etc.
In attempting to busbuild the new function, I'm down to just a few errors that I don't know how to fix. I'm wondering if someone on JDElist can help.
The specific errors in the Busbuild are:
-------------------------------------------
C:\B7\DV7333\source\B5542032.c(72) : error C2065: 'DSDE0022' : undeclared identifier
C:\B7\DV7333\source\B5542032.c(72) : error C2146: syntax error : missing ';' before identifier 'dsDE0022'
C:\B7\DV7333\source\B5542032.c(72) : error C2065: 'dsDE0022' : undeclared identifier
C:\B7\DV7333\source\B5542032.c(258) : warning C4047: 'function' : 'char *' differs in levels of indirection from 'char '
C:\B7\DV7333\source\B5542032.c(258) : warning C4024: 'IsStringBlank' : different types for formal and actual parameter 1
C:\B7\DV7333\source\B5542032.c(285) : error C2224: left of '.szDescription' must have struct/union type
C:\B7\DV7333\source\B5542032.c(285) : warning C4090: 'function' : different 'const' qualifiers
C:\B7\DV7333\source\B5542032.c(285) : warning C4024: 'strcpy' : different types for formal and actual parameter 1
C:\B7\DV7333\source\B5542032.c(285) : error C2198: 'strcpy' : too few actual parameters
-------------------------------------------
I'm mystified by the first few errors regarding the DSDE0022. This was essentially code that I copied directly from the original BSFN and didn't alter. The code looks like this:
/************************************************************************
* Declare structures
************************************************************************/
JDECMINDEXSTRUCT jdecmIndexF42UI12[2] = {0};
F42UI12 dsF42UI12;
KEY1_F42UI12 dsF42UI12Key1;
DSDE0022 dsDE0022;
I believe I know what's causing the char related errors that follow the DSDE0022 errors. The original code updated fields that were all either string or numeric type. My new code needs to update a character type field. I think I need to use some sort of different syntax to work with a character field. Below is the code I have now:
if (!IsStringBlank(lpDS->cSubledgerType_SBLT))
{
strcpy((char *)(&dsF42UI12.zdsblt),(const char *)(&lpDS->cSubledgerType_SBLT));
}
How should it be changed?
I'm not sure about the final errors, but they are referring to a line that hits DSDE0022 again, and perhaps will be corrected by fixing whatever the issue is with that declaration. Below is the segment with the line in question:
if (jdeCacheResult != JDECM_PASSED || idJDEDBReturn != JDEDB_PASSED)
{
memset((void *)&dsDE0022, (int)'\0', sizeof(dsDE0022));
strcpy((char *)dsDE0022.szDescription, (const char *)"F42UI12");
if (lpDS->cUseWorkfile_WFOC == '2')
{
/* If the Cache Update failed */
jdeSetGBRErrorSubText(lpBhvrCom, lpVoid, (ID)0, "078P", &dsDE0022);
}
else
{
/* If the Update Table failed */
jdeSetGBRErrorSubText(lpBhvrCom, lpVoid, (ID)0, "078H", &dsDE0022);
}
idReturnValue = ER_ERROR;
}
Thanks in advance for any help on this.
Now, I'm not a C programmer and usually do most of my development in JDE with the base toolset and NER when a function is needed. I had a couple of C classes back in college, but that was a long time ago. I'd say I know enough to understand the processing that occurs in C code when I read it, but not enough to be sure of proper syntax, structure, commands, etc.
In attempting to busbuild the new function, I'm down to just a few errors that I don't know how to fix. I'm wondering if someone on JDElist can help.
The specific errors in the Busbuild are:
-------------------------------------------
C:\B7\DV7333\source\B5542032.c(72) : error C2065: 'DSDE0022' : undeclared identifier
C:\B7\DV7333\source\B5542032.c(72) : error C2146: syntax error : missing ';' before identifier 'dsDE0022'
C:\B7\DV7333\source\B5542032.c(72) : error C2065: 'dsDE0022' : undeclared identifier
C:\B7\DV7333\source\B5542032.c(258) : warning C4047: 'function' : 'char *' differs in levels of indirection from 'char '
C:\B7\DV7333\source\B5542032.c(258) : warning C4024: 'IsStringBlank' : different types for formal and actual parameter 1
C:\B7\DV7333\source\B5542032.c(285) : error C2224: left of '.szDescription' must have struct/union type
C:\B7\DV7333\source\B5542032.c(285) : warning C4090: 'function' : different 'const' qualifiers
C:\B7\DV7333\source\B5542032.c(285) : warning C4024: 'strcpy' : different types for formal and actual parameter 1
C:\B7\DV7333\source\B5542032.c(285) : error C2198: 'strcpy' : too few actual parameters
-------------------------------------------
I'm mystified by the first few errors regarding the DSDE0022. This was essentially code that I copied directly from the original BSFN and didn't alter. The code looks like this:
/************************************************************************
* Declare structures
************************************************************************/
JDECMINDEXSTRUCT jdecmIndexF42UI12[2] = {0};
F42UI12 dsF42UI12;
KEY1_F42UI12 dsF42UI12Key1;
DSDE0022 dsDE0022;
I believe I know what's causing the char related errors that follow the DSDE0022 errors. The original code updated fields that were all either string or numeric type. My new code needs to update a character type field. I think I need to use some sort of different syntax to work with a character field. Below is the code I have now:
if (!IsStringBlank(lpDS->cSubledgerType_SBLT))
{
strcpy((char *)(&dsF42UI12.zdsblt),(const char *)(&lpDS->cSubledgerType_SBLT));
}
How should it be changed?
I'm not sure about the final errors, but they are referring to a line that hits DSDE0022 again, and perhaps will be corrected by fixing whatever the issue is with that declaration. Below is the segment with the line in question:
if (jdeCacheResult != JDECM_PASSED || idJDEDBReturn != JDEDB_PASSED)
{
memset((void *)&dsDE0022, (int)'\0', sizeof(dsDE0022));
strcpy((char *)dsDE0022.szDescription, (const char *)"F42UI12");
if (lpDS->cUseWorkfile_WFOC == '2')
{
/* If the Cache Update failed */
jdeSetGBRErrorSubText(lpBhvrCom, lpVoid, (ID)0, "078P", &dsDE0022);
}
else
{
/* If the Update Table failed */
jdeSetGBRErrorSubText(lpBhvrCom, lpVoid, (ID)0, "078H", &dsDE0022);
}
idReturnValue = ER_ERROR;
}
Thanks in advance for any help on this.