I'm trying to obtain a list of a specific type with the next code, but the result into the list information are erroneous, Can you help me to find where I'm going wrong ? ( Hope no strange chars into the source code
http://code.midrange.com/ ;)
1. #include <QGYOLOBJ.h>
2.
3. #include <qusec.h> /* Error Code Parameter Include for the APIs */
4. #include <qwcattr.h> /* Job str */
5.
6. struct SelectionControl
7. {
8. Qgy_Olobj_SelControl_t selControl ;
9. char status;
10. };
11.
12. struct Receiver
13. {
14. Qgy_Olobj_RecVar_t receiver ;
15. Qgy_Olobj_KeyData_t keys ;
16. } ;
17.
18. int main ()
19. {
20. int numToRet = 1000 ;
21. Receiver * receiver = new Receiver [numToRet ] ;
22.
23.
24. int szRec = sizeof ( Receiver) * numToRet;
25.
26. Qgy_Olobj_ListInfo_t listInfo ;
27. Qgy_Olobj_SortInfo_t sortInfo ;
28. sortInfo.Num_Keys = 0 ;
29.
30. char qualifPgm [20] ;
31. strncpy ( qualifPgm , "*ALL " , 10 ) ;
32. strncpy ( qualifPgm +10 , "QGPL " , 10 ) ;
33. char type [10] ;
34. strncpy ( type , "*USRSPC " , 10 ) ;
35.
36. Qgy_Olobj_AuthControl_t authCtrl ;
37. authCtrl.Format_Length = sizeof(authCtrl) ;
38. authCtrl.Call_Level = 1 ;
39. authCtrl.Obj_Auth_Offset = 0 ;
40. authCtrl.Lib_Auth_Offset = 0 ;
41. authCtrl.Num_Lib_Auth = 0 ;
42. authCtrl.Num_Obj_Auth = 0 ;
43. // authCtrl.Reserved = 0x0 ;
44.
45.
46. SelectionControl selControl ;
47. selControl.selControl.Format_Length = sizeof(selControl);
48. selControl.selControl.Num_Status = 1;
49. selControl.selControl.Sel_or_Omit_Status = 0;
50. selControl.selControl.Status_Offset = sizeof(selControl);
51. //selControl.selControl.Reserved = 0x0 ;
52. selControl.status = '*';
53.
54. int numKeys = 1;
55.
56. errorCode_t errorCode ;
57. errorCode.ec_fields.Bytes_Provided = sizeof (errorCode) ;
58.
59. Qwc_JIDF0100_t jobInfo ;
60. strncpy ( jobInfo.Job_Name , "*INT " , 10 ) ;
61.
62. Qgy_Olobj_ASPControl_t aspCtrl ;
63. aspCtrl.Format_Length = 24 ;
64. strncpy( aspCtrl.ASP_Device_Name, "*SYSBAS ", 10 ) ;
65. strncpy( aspCtrl.ASP_Search_Type, " ", 10 ) ;
66.
67. int keyFields[1] ;
68. keyFields[0] = 301 ;
69.
70. QGYOLOBJ (receiver, /* Receiver variable */
71. szRec , /* Length of receiver variable */
72. &listInfo, /* List Information */
73. numToRet , /* Number of records to return */
74. &sortInfo, /* Sort Information */
75. qualifPgm, /* Object and Library name */
76. type , /* Object type */
77. &authCtrl, /* Authority control */
78. &selControl, /* Selection control */
79. numKeys , /* Number of fields to return */
80. keyFields, /* Key of fields to return */
81. &errorCode, /* Error code */
82. "* ", /* void * Job identification info */
83. &jobInfo , /* void * Fmt job ID info*/
84. &aspCtrl ); /* void * Auxiliary storage
85. pool (ASP) control @B0A*/
86.
87. printf ( "Total Records [%d]\n" , listInfo.Total_Records) ;
88. printf ( "Info Complete [%c]\n" , listInfo.Info_Complete) ;
89. printf ( "Returned %d" , listInfo.Records_Retd);
90. return 0 ;
91. }
--- Grace Pahuasi---
As an Amazon Associate we earn from qualifying purchases.