Hi,
I'm trying to use the QGYOLOBJ API to get all the objects from one type but always gave me invalid results into the List Information str:
struct SelectionControl
{
Qgy_Olobj_SelControl_t selControl ;
char status;
};
struct Receiver
{
Qgy_Olobj_RecVar_t receiver ;
Qgy_Olobj_KeyData_t keys ;
} ;
int main ()
{
int numToRet = 1000 ;
Receiver * receiver = new Receiver [1000] ;
int szRec = sizeof ( Receiver) * numToRet;
Qgy_Olobj_ListInfo_t listInfo ;
Qgy_Olobj_SortInfo_t sortInfo ;
sortInfo.Num_Keys = 0 ;
char qualifPgm [20] ;
strncpy ( qualifPgm , "*ALL " , 10 ) ;
strncpy ( qualifPgm +10 , "QGPL " , 10 ) ;
char type [10] ;
strncpy ( type , "*USRSPC " , 10 ) ;
Qgy_Olobj_AuthControl_t authCtrl ;
authCtrl.Format_Length = sizeof(authCtrl) ;
authCtrl.Call_Level = 1 ;
authCtrl.Obj_Auth_Offset = 0 ;
authCtrl.Lib_Auth_Offset = 0 ;
authCtrl.Num_Lib_Auth = 0 ;
authCtrl.Num_Obj_Auth = 0 ;
SelectionControl selControl ;
selControl.selControl.Format_Length = sizeof(selControl);
selControl.selControl.Num_Status = 1;
selControl.selControl.Sel_or_Omit_Status = 0;
selControl.selControl.Status_Offset = sizeof(selControl);
//selControl.selControl.Reserved = 0x0 ;
selControl.status = '*';
int numKeys = 1;
errorCode_t errorCode ;
errorCode.ec_fields.Bytes_Provided = sizeof (errorCode) ;
Qwc_JIDF0100_t jobInfo ;
strncpy ( jobInfo.Job_Name , "*INT " , 10 ) ;
Qgy_Olobj_ASPControl_t aspCtrl ;
aspCtrl.Format_Length = 24 ;
strncpy( aspCtrl.ASP_Device_Name, "*SYSBAS ", 10 ) ;
strncpy( aspCtrl.ASP_Search_Type, " ", 10 ) ;
int keyFields[1] ;
keyFields[0] = 301 ;
QGYOLOBJ (receiver, /* Receiver variable */
szRec , /* Length of receiver variable */
&listInfo, /* List Information */
numToRet , /* Number of records to return */
&sortInfo, /* Sort Information */
qualifPgm, /* Object and Library name */
type , /* Object type */
&authCtrl, /* Authority control */
&selControl, /* Selection control */
numKeys , /* Number of fields to return */
keyFields, /* Key of fields to return */
&errorCode, /* Error code */
"* ", /* void * Job identification info */
&jobInfo , /* void * Fmt job ID info*/
&aspCtrl ); /* void * Auxiliary storage
pool (ASP) control @B0A*/
printf ( "Total Records [%d]n" , listInfo.Total_Records) ;
printf ( "Info Complete [%c]n" , listInfo.Info_Complete) ;
printf ( "Returned %d" , listInfo.Records_Retd);
return 0 ;
}
Where can be wrong ?
Software/Hardware used:
v5r4,QGYOLOBJ
Discuss This Question: 14  Replies