Xe_na_thanks
Active Member
Dear List,
I am trying to read a custom file by three fields.
MCU
ITM
TRDJ
However when I run my business function it uses the primary key, i.e.
ORDER BY SCKCOO ASC,SCDOCO ASC,SCDCTO ASC,SCLNID ASC
From the debug log.
I have selected the right key in the ER on both the select and fetch next. The ER compiles to;
/* F5500100(VA evt_idF5500100Handle_F55100).Select */
if ( RTK_CER_FIOGetHandleInfo( evt_idF5500100Handle_F55100HN , &zHndlInfo ) )
{
pAppVars->iTableRetCode = ER_ERROR;
if ( JDB_ClearSelection( zHndlInfo.hReqest ) == JDEDB_PASSED )
{
RTK_CER_FIOSelectInitH( zSelect45 , 2 , zHndlInfo.nType ,
zHndlInfo.szFileName , 0L );
jdeNIDcpy( zSelect45[0].Item1.szDict , "MCU" );
if ( zHndlInfo.nType == FILEIO_TYPE_VIEW )
{
jdeNIDcpy( zSelect45[0].Item1.szTable , "F5500100" );
zSelect45[0].Item1.idInstance = 0L;
}
zSelect45[0].lpValue = (LPVOID)lpDS->szCostCenter;
jdeNIDcpy( zSelect45[1].Item1.szDict , "ITM" );
if ( zHndlInfo.nType == FILEIO_TYPE_VIEW )
{
jdeNIDcpy( zSelect45[1].Item1.szTable , "F5500100" );
zSelect45[1].Item1.idInstance = 0L;
}
zSelect45[1].lpValue = (LPVOID)&lpDS->mnIdentifierShortItem;
RTK_CER_FIOSelect( zHndlInfo.hReqest , 4L , 2 , zSelect45 ,
&pAppVars->iTableRetCode );
/* F5500100(VA evt_idF5500100Handle_F55100).Fetch Next */
if ( RTK_CER_FIOGetHandleInfo( evt_idF5500100Handle_F55100HN , &zHndlInfo ) )
{
if ( JDB_Fetch( zHndlInfo.hReqest , &zF5500100_47 , 0 ) != JDEDB_PASSED )
{
JDB_ClearSelection( zHndlInfo.hReqest );
JDB_ClearSequencing( zHndlInfo.hReqest );
pAppVars->iTableRetCode = ER_ERROR;
}
else
{
jdeStrcpy( evt_szCompanyKeyOrderNo_KCOO , zF5500100_47.sckcoo ,
sizeof( evt_szCompanyKeyOrderNo_KCOO ) );
MathCopy( &evt_mnDocumentOrderInv_DOCO , &zF5500100_47.scdoco );
jdeStrcpy( evt_szOrderType_DCTO , zF5500100_47.scdcto ,
sizeof( evt_szOrderType_DCTO ) );
MathCopy( &evt_mnLineNumber_LNID , &zF5500100_47.sclnid );
jdeStrcpy( evt_szCostCenter_MCU , zF5500100_47.scmcu ,
sizeof( evt_szCostCenter_MCU ) );
MathCopy( &evt_mnUnitsTransactionQty_UORG , &zF5500100_47.scuorg );
pAppVars->iTableRetCode = ER_SUCCESS;
}
Anyone got any ideas? I really need it in that sequence! Do triggers have anything to do with it? Is the sequencing done in the select or the fetch next? Has;
RTK_CER_FIOSelect( zHndlInfo.hReqest , 4L , 2 , zSelect45 ,
&pAppVars->iTableRetCode );
replaced the JDB_SelectKeyed function?
And how do you without re writing this in C force it to use the key selected not the primary keys. All encouragement and words of wisdom (and just plain old chat) will be very welcome. It has been a rough couple of weeks.
Adrian.
Xe SP15 Update1 applied AS400 V4R4 DB2, World A73 Cum 11 00X2
I am trying to read a custom file by three fields.
MCU
ITM
TRDJ
However when I run my business function it uses the primary key, i.e.
ORDER BY SCKCOO ASC,SCDOCO ASC,SCDCTO ASC,SCLNID ASC
From the debug log.
I have selected the right key in the ER on both the select and fetch next. The ER compiles to;
/* F5500100(VA evt_idF5500100Handle_F55100).Select */
if ( RTK_CER_FIOGetHandleInfo( evt_idF5500100Handle_F55100HN , &zHndlInfo ) )
{
pAppVars->iTableRetCode = ER_ERROR;
if ( JDB_ClearSelection( zHndlInfo.hReqest ) == JDEDB_PASSED )
{
RTK_CER_FIOSelectInitH( zSelect45 , 2 , zHndlInfo.nType ,
zHndlInfo.szFileName , 0L );
jdeNIDcpy( zSelect45[0].Item1.szDict , "MCU" );
if ( zHndlInfo.nType == FILEIO_TYPE_VIEW )
{
jdeNIDcpy( zSelect45[0].Item1.szTable , "F5500100" );
zSelect45[0].Item1.idInstance = 0L;
}
zSelect45[0].lpValue = (LPVOID)lpDS->szCostCenter;
jdeNIDcpy( zSelect45[1].Item1.szDict , "ITM" );
if ( zHndlInfo.nType == FILEIO_TYPE_VIEW )
{
jdeNIDcpy( zSelect45[1].Item1.szTable , "F5500100" );
zSelect45[1].Item1.idInstance = 0L;
}
zSelect45[1].lpValue = (LPVOID)&lpDS->mnIdentifierShortItem;
RTK_CER_FIOSelect( zHndlInfo.hReqest , 4L , 2 , zSelect45 ,
&pAppVars->iTableRetCode );
/* F5500100(VA evt_idF5500100Handle_F55100).Fetch Next */
if ( RTK_CER_FIOGetHandleInfo( evt_idF5500100Handle_F55100HN , &zHndlInfo ) )
{
if ( JDB_Fetch( zHndlInfo.hReqest , &zF5500100_47 , 0 ) != JDEDB_PASSED )
{
JDB_ClearSelection( zHndlInfo.hReqest );
JDB_ClearSequencing( zHndlInfo.hReqest );
pAppVars->iTableRetCode = ER_ERROR;
}
else
{
jdeStrcpy( evt_szCompanyKeyOrderNo_KCOO , zF5500100_47.sckcoo ,
sizeof( evt_szCompanyKeyOrderNo_KCOO ) );
MathCopy( &evt_mnDocumentOrderInv_DOCO , &zF5500100_47.scdoco );
jdeStrcpy( evt_szOrderType_DCTO , zF5500100_47.scdcto ,
sizeof( evt_szOrderType_DCTO ) );
MathCopy( &evt_mnLineNumber_LNID , &zF5500100_47.sclnid );
jdeStrcpy( evt_szCostCenter_MCU , zF5500100_47.scmcu ,
sizeof( evt_szCostCenter_MCU ) );
MathCopy( &evt_mnUnitsTransactionQty_UORG , &zF5500100_47.scuorg );
pAppVars->iTableRetCode = ER_SUCCESS;
}
Anyone got any ideas? I really need it in that sequence! Do triggers have anything to do with it? Is the sequencing done in the select or the fetch next? Has;
RTK_CER_FIOSelect( zHndlInfo.hReqest , 4L , 2 , zSelect45 ,
&pAppVars->iTableRetCode );
replaced the JDB_SelectKeyed function?
And how do you without re writing this in C force it to use the key selected not the primary keys. All encouragement and words of wisdom (and just plain old chat) will be very welcome. It has been a rough couple of weeks.
Adrian.
Xe SP15 Update1 applied AS400 V4R4 DB2, World A73 Cum 11 00X2