• 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!

AS/400 & AllocatePOVersionData

R. Lalyko

Member
Dear X,
on our One World XE system we need external access for warehouse confirmation ...
We recognized diffrent program behavoir on two plattforms:
On NT - Workstation:
The test program runs correctly. !!!
On AS400 V4R5M0:
The test program fails: the kernel function "AllocatePOVersionData" returns only blank data for existing versions.
(If a version does not exist: a failure is returned => correct).

May you have a look at the source code of our test program.

We saw some informations of menory violation by "AllocatePOVersionData" older One World releases (Knowledge Garden)

thanks for help,

R. Lalyko
IGEPA Tech. Berlin

In Addition: SourceCode

/******************************************************************/
/* Login & Call "AllocatePOVersionData" */
/*(may there are some notaion faults, cause copy AS/440-> WinNT */
/******************************************************************/

#include <jde.h>
#include <b4600730.h>

typedef struct tagDST4617B
{
char cTwoPhase_EV01;
char cGlossaryText_EV01;
char szStatusCodeNext_NXTR[4];
char cCallBulkPickDetailReport;
char szBulkPickDetailReportVersion[11];
char cPPSGenerateCartonDetail;
char szP4620CartonDetailVersion[11];
} DST4617B, *LPDST4617B;


/* MAIN */
int __cdecl main (int argc, char *argv¬|)
{
/* Declaration of environment variables */
HENV hEnv = NULL;
HUSER hUser = NULL;
JDEDB_RESULT rcode;
char szEnv[11] = "DV7333";
char szUser[11] = "OWUSER01";
char szPwd[11] = "owuser01";

ID idResult;
BOOL boolResult;
int j = 0;
INT NumErrors = 0;
INT NumWarnings = 0;
LPJDEERROR_RECORD ErrorRec;
LPDST4617 lpdsP4617PO = (LPDST4617) NULL;
LPDST4617B lpdsR4617PO = (LPDST4617B) NULL;
char output¬160|;
int cnt = 0;
int dsSZ = 0;

/* jdeCallObject variables */

LPCG_BHVR lpVoid = NULL;
LPVOID lpDS = NULL;
LPBHVRCOM lpBhvrCom = NULL;
ERROR_EVENT_KEY EventKeyLocal;

/* Initialize Environment Handle */
printf ("Now creating hEnv...\n");

if((rcode = JDB_InitEnvOvr (&hEnv, szEnv, szUser, szPwd))
]= JDEDB_PASSED)
{
printf ("JDB_InitEnvOvr failed.\n");
return (0);
}

printf (" hEnv=%p\n", hEnv);

/* Initialize User */
printf ("Now creating hUser...\n");

if ((rcode = JDB_InitUser (hEnv, &hUser, NULL, JDEDB_COMMIT_AUTO)) != JDEDB_PASSED)
{
printf ("JDB_InitUser failed.\n");
JDB_FreeEnv (hEnv);
return (0);
}

printf (" hUser=%p\n", hUser);
/* memcpy (output,hUser,sizeof(HUSER)); */
/* printf ("\nInfo:\n%s\n",output); */
/* Set up the lpBhvrCom amd lpVoid objects */
printf ("Now creating lpBhvrCom...\n");

if (](boolResult = jdeCreateBusinessFunctionParms
(hUser, &lpBhvrCom, (LPVOID*) &lpVoid)))
{
printf ("jdeCreateBusinessFunctionParms failed.\n");
JDB_FreeUser (hUser);
JDB_FreeEnv (hEnv);
return (0);
}

printf (" lpBhvrCom=%p\n", lpBhvrCom);
printf (" lpVoid=%p\n", lpVoid);


/* Initialize GetP4617ProcessingOptions Datastructure */
/* memset ((void *)lpdsP4617PO, (int)'\0', sizeof(DST4617)); */




printf ("Now calling 'AllocatePOVersionData'\n");

/*========================================*/
/* Running on NT-Workstation OK, */
/* running on AS400 return of a blank data structure */
/*========================================*/
lpdsR4617PO = (LPDST4617B)AllocatePOVersionData(hUser,
"R4617",
"IGP46001W",
sizeof(DST4617B));

if (lpdsR4617PO)
{

printf ("Status=%s\n", lpdsR4617PO->szStatusCodeNext_NXTR);

memcpy (output,lpdsR4617PO,sizeof(DST4617B));
printf ("\nLPDS:\n%s#\nSize=%i",output,sizeof(DST4617B));
printf("\nLOOP\n");

dsSZ = sizeof(DST4617B);
while(cnt<dsSZ)
{
printf("B%i:'%i'", cnt, output¬cnt|);
cnt = cnt + 1;
}
printf("\nEND-LOOP\n");
}
else
{
printf ("ERROR: Version failed\n");
}
/* Free PO Datastructure */
FreePODataStructure((void*)lpdsR4617PO);

printf ("Now freeing lpBhvrCom and lpVoid...\n");

jdeFreeBusinessFunctionParms (lpBhvrCom, lpVoid);

/* Free user when done processing before freeing the environment */
printf ("Now freeing hUser...\n");

if (hUser)
{
if ((rcode = JDB_FreeUser (hUser)) ]= JDEDB_PASSED)
{
printf ("JDB_FreeUser failed.\n");
return (0);
}
}

/* Free Environment Handle */
printf ("Now freeing hEnv...\n");

if (hEnv)
{
if ((rcode = JDB_FreeEnv (hEnv)) ]= JDEDB_PASSED)
{
printf ("JDB_FreeEnv failed.\n");
return (0);
}
}

return (1);
}


RLA
DANS Europe s.a.
52, rue Emile Mayrisch
L-4240 Esch-Sur-Alzette
 
Top