[adrotate group=”3,7,8″]
If you are using C for calling the above API it is important that you initialize the Continuation Handle to blanks before calling the API. This is because failing to initialize the parameter will cause unpredictable results. We have asked IBM to change the documentation to reflect this requirement but in the meantime we felt it is important that you understand this requirement.
Here is a sample program we shipped to IBM for testing which shows the effect of not setting the parameter (Note: in RPG the problem does not exist because the compiler initializes the parameter before calling the program automatically.)
#include/* List job schedule entries */ #include /* std input / output */ #include /* File record I/O */ #include /* Std Lib */ #include /* generic space header */ #include /* usrspc ptr */ #include /* usrspc ptr */ #include /* send message */ #include /* error code */ typedef _Packed struct EC_x { Qus_EC_t EC; char Exception_Data[48]; } EC_t; int Crt_Usr_Spc(char *, int); int main(int argc, char **argv) { int i = 0; char Req_SPC[20] = "JESPC QTEMP "; /* usrspc name */ char Format[8] = "SCDL0100"; /* output format */ char Cont_Hdl[16]; /* continuation Handle */ char *tmp; /* pointer */ Qwc_SCDL0100_t *List_Entry; /* data pointer */ Qus_Generic_Header_0100_t *space; /* User Space Hdr Ptr */ EC_t Error_Code = {0}; /* Error Code */ Error_Code.EC.Bytes_Provided = sizeof(Error_Code); QUSPTRUS(Req_SPC, &space, &Error_Code); if(Error_Code.EC.Bytes_Available > 0){ printf("QUSPTRUS %.7sn",Error_Code.EC.Exception_Id); exit(-1); } QWCLSCDE(Req_SPC, Format, argv[1], Cont_Hdl, &Error_Code); if(Error_Code.EC.Bytes_Available > 0){ printf("QWCLSCDE %.7sn",Error_Code.EC.Exception_Id); exit(-1); } if(space->Number_List_Entries <= 0) { printf("No entries foundn"); exit(0); } tmp = (char *)space; tmp += space->Offset_List_Data; List_Entry = (Qwc_SCDL0100_t *)tmp; for(i = 0; i < space->Number_List_Entries; i++) { printf("JobName = %.10sn",List_Entry->Job_Name); printf("Status = %.3sn",List_Entry->Status); printf("Scheduled Date = %.10sn",List_Entry->Scheduled_Date); printf("Scheduled Time = %.6sn",List_Entry->Scheduled_Time); printf("Frequency = %.10sn",List_Entry->Frequency); List_Entry++; } exit(0); }
The above code expects the user space used to receive the output to already exist.
Chris…
IBM feels the API is working as described, so if you use the API ensure you initialize the parameter to blanks before calling the API or the results may not be as expected.
Chris…