Misaligned Data/JDB_Fetch/Visual C++ Settings

Here's my guess-> you can't do it that way. :grin:


Take a closer look at the code you have there. I'm betting you copied it from B9600486. The only difference is how the JDB_Fetch works on a foreign table. Notice how JDE uses their API to get to columns and not entire rows with data structures:

while ((eJDEDBReturn = JDB_Fetch(hReqDownload_audit, (void *) NULL, FALSE)) == JDEDB_PASSED)
{
/*Get the email column which is number 10 column*/
jdeNIDcpy (dbRef.szTable, "FOREIGN1");
dbRef. idInstance = 0;
jdeNIDcpy (dbRef.szDict, "10");
...
jdeStrcpy(dsKey1F96409.emsuemail, JDB_GetTableColValue (hReqDownload_audit, dbRef), sizeof(dsKey1F96409.emsuemail));


Of interest is the JDB_GetTableColValue using the hRequest and dbRef structure. They don't try to grab a record in a structure pointer passed to JDB_Fetch. Instead, they name table, row and column AFTER the fetch. I'd bet their middleware isn't super dynamic (i.e. does all that work for free), so they rely on some ODBC code to get columns individually with a seperate API. That makes sense to me anyway.

Give their technique a whirl. I bet it works.

Good Luck!
 
Thanks WP. And yeah, I know I'm asking for a lot but I figure it's got to be possible because you can do this from a table conversion and that's what started me down this road. And you are correct -- I copied B9600486.

I did go to try your suggestion and then discovered that I was already doing it. When the call to JDB_Fetch did not return the values I was expecting, I proceeded to calling JDB_GetTableColValue for each of the first five columns. I don't care how I get the data as long as I get it.

Unfortunately, while it comes up with a little more information (still does not come up with LITM though), overall this doesn't work either. In fact, on the fourth call (if you can believe this) it 0's out hReqDownload_audit and is unable to retrieve any more data after that.

I just know there's got to be a way! I'm still trying...
 
Right, let's try and look at this a different way.
I would assume, that when you debug the fetch, that the data returned is always in the same format (just not the format that you are expecting) for each fetch statement.
I'm wondering where you got your table specification from. I would recheck this definition - check against world definition and against the DB definition.
 
Re: RE: Misaligned Data/JDB_Fetch/Visual C++ Settings

Thanks, Peter.

I got the table specifications from dbu on the AS/400. But remember, the same thing happens when I run the same business function using a non-foreign data source, in my case Business Data - CRP. The data shows up in the same format in memory. It appears to be skipping LITM and AITM and moving from ITM to DSC1, which isn't correct for either table. However, if I use JDB_OpenTable on the non-foreign table, the data shows up fine after the JDB_Fetch.

I've put in a call to JDE/Peoplesoft as a last resort. I'll be sure to let you all know what they've said, helpful or not.

In the meantime, feel free to suggest anything...Thanks!
 
Re: RE: Misaligned Data/JDB_Fetch/Visual C++ Settings

do you check the base's driver use in both case.
Especially, what driver did you define in the external datasource you use with the JDB_OpenForeignTable.
If you didn't define a datasource, you have to define yet (look into knowledge garden). :p
 
Re: RE: Misaligned Data/JDB_Fetch/Visual C++ Settings

Thanks sviardot. I do have data sources, but again it doesn't seem to matter what the driver is. I'm connecting to the foreign database using Client Access on the AS/400 and to the OneWorld database (RS6000) using IBM DB2 ODBC. Yet the results are the same as far as the results retrieved.
 
Re: RE: Misaligned Data/JDB_Fetch/Visual C++ Settings

My 2 cents...

You are obviously dealing with ERP8.9 since you are using JCHAR. The debug screen seems to indicate that the JDB APIs are translating the data no matter what.

Please try the following:

1- Go in database data source definition
2- Copy Business Data - CRP to Business Data - CRPnu
3- In the new data source definition, in the advanced setup, uncheck UNICODE

After that, either use that source in your code, or change OCM to point to that new source.

I am curious to see the result!
 
Re: RE: Misaligned Data/JDB_Fetch/Visual C++ Settings

AND WE HAVE A WINNER!!!
SLE118!!!

I did already have UNICODE off for the data source, but your comment made me want to go check the ODBC data source out.

When I had changed the data source in OneWorld and it asked whether I wanted to modify the ODBC data source, I had chosen "Silent" mode and never went back to check that it was OK. So once I went back, I checked the Translation tab and sure enough, the box to set up translating from CCSID was unchecked, which I knew was wrong. So I checked the box and tried again.

AND IT WORKED!

Now how screwy is that? Usually if translation is off, all of the data is messed up and we wouldn't have seen the item number and descriptions the way they showed. Who would have thought?

Anyway, I'm happy to say that this problem has been solved and thank you all so very much for your ideas. You guys are awesom! Thank you!
 
Re: RE: Misaligned Data/JDB_Fetch/Visual C++ Settings

And we have a winner, sabdeen !!!

I merely sent you in a direction and on your way you've solved your problem yourself!

The CCSID translation is effective only with text columns having the CSSID set to 65535 in a specific table. Since the item number is a numerical value, the driver will correctly translate it to a Math Numeric.

I wonder what the definition of the table is...

Before we forget about this informative thread, could you post the result of:

DSPFFD F4101
 
Re: RE: Misaligned Data/JDB_Fetch/Visual C++ Settings

Thanks sle118. I cannot figure out a way to post the entire file description, but I can tell you that you're correct in that IMITM is numeric and the other fields are CCSID 65535. If you can tell me a way to get the contents into a file, then I could attach them here.
 
Back
Top