• Introducing Dark Mode! Switch by clicking on the lightbulb icon next to Search or by clicking on Default style at the bottom left of the page!

Question related to "jdestrcmp" in a C++ BSFN?

fvlmasl2

Active Member
I have an 2 Level Array[6] that I have populated and comparing that to a "lpDS->szFranchiseCode" ....so for example....


The "lpDS->szFranchiseCode" contains "COD"

The &mnArray[6] contains what was thought to would be [I = 300] and [6 = COD]. The I index is correct, but the 6 index only contains the first character "C". Below is the actual statement:

if (jdeStrcmp((const JCHAR*)&mnProArray[6], (const JCHAR*)lpDS->szFranchiseCode) == 0)

Thanks for the assistance....
fvlmasl2
 

BOster

Legendary Poster
What is the type of mnProArray - based on the hungarian notation it looks to be a MATH_NUMERIC and not a string? Is mnProArray really a multi-dementional array, or in this case an array of strings - i.e. JCHAR mnProArray[x][y]?

Quite honestly that line of code looks all kind of wrong.
 

fvlmasl2

Active Member
Thank you for the reply... it is a multi-dimensional array. Its 999x8, I've used arrays often in my RPG days. I decided to use Math_Numeric because most fields being populated are numeric. I did modify the IF from the above because it was incorrect. How I've been able to get around my issue was to create a Data Structure, move the array element to the DS and then do the IF. Now, this may not be the proper way to do this, but it did work. I had our CNC staff check all servers for errors related to memory leaks and the like.

With zero training in JDE development, I've had to reverse engineer everything I've needed to do. I guess for those more experienced than me, how would a comparison be done for an array element and a string field?

Thanks again,
fvlmasl2
 

BOster

Legendary Poster
With zero training in JDE development, I've had to reverse engineer everything I've needed to do. I guess for those more experienced than me, how would a comparison be done for an array element and a string field?
I would start with Standard ANSI C training, then "JDE C" training. If you don't properly understand the C language constructs first you can't possibly hope to code in JDE C. If mnProArray is type MATH_NUMERIC you should NOT be using any kind of string functions at all. Based on the hungarian notation you are trying to compare a MATH_NUMERIC to a C style string which just cannot be done (aside from a comparison on the MATH_NUMERIC struct string member which *SHOULD NOT* be done). Again, your code snippet doesn't appear to be correct in any way even if mnProArray was a C style string.
 
Top