Get the ASPs with QYASPOL API from c++

415 pts.
Tags:
API
ASP
iseries v5r4
QYASPOL
I trying to get the ASP with the QYASPOL API from c++ but the next source code only 
returns data in the info variable , the receiver looks empty :S , could you point me in the right direction ? 
#include <QYASPOL.h> 
#include <stdio.h> 
#include <qusec.h> 
#include <QGYGTLE.h> 
 ...
 
 typedef struct 
 {  YASP_Filter_t filterByNumber ; 
    int  data    ; 
 }FilterInfo_t ;   
 
 
 
int main () {  
 int sz = 1024 ; 
 char receiver [1024 ] ;              
 
 
 YASP_List_Information_t  info ;
 
 int numRecords = -1 ;     
 int numFilters =  1 ;    
 FilterInfo_t filterInfo ; 
 filterInfo.filterByNumber.Key = 1 ;   
 filterInfo.filterByNumber.Data_Size = 4 ;                        
 filterInfo.data = -1 ;                                           
 filterInfo.filterByNumber.Entry_Size = sizeof ( FilterInfo_t) ;  
                                                                  
 char format[] = "YASP0100";                                      
                                                                  
 QYASPOL ( receiver ,&sz,&info ,&numRecords ,                     
       &numFilters ,&filterInfo,  format ,&errorCode ) ;          
   
                                                                    
 printf ( "TR:%d n" , info.Total_Records ) ;                               
 printf ( "RR:%d n" , info.Records_Returned ) ;                            
 printf ( "sz:%d n" , info.Information_Length ) ;   
 printf ( "Device Desc [%s] n" , ((YASP0100_t *) ptr )-> Device_Desc ) ;    
TR:3 
RR:3 
sz:168 
Number:[1] 
Device Desc [       ]


Software/Hardware used:
v5r4, QYASPOL

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question: 5  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • TomLiotta
    int numRecords = -1 ;
    Try changing that to:
    int numRecords = 1 ;
    Since you are requesting format YASP0100 and it's only 64 bytes long, you could probably use:
    int numRecords = 16 ;
    By specifying Number of records to return as -1, the list will be built synchronously. But because it's a negative 1, you haven't actually asked that any records be returned to your program. All records should then need to be returned through calls to the Get List Entries (QGYGTLE) API. I haven't quite figured out why this API was created as an "Open List..." API. It wouldn't seem ever to be enough ASPs to demand that much effort. Tom
    125,585 pointsBadges:
    report
  • GraceP
    Thanks TomLiotta! Changed to 16 and using the QGYGTLE API and it gave me the ASP info :)
      Qgy_Gtle_ListInfo_t  listInfo ;                   
                                                        
                                                        
      char * handler = info.Request_Handle  ;           
      char r2 [1024 ];
                                                        
      QGYGTLE ( r2 ,                                    
                1024 ,                                  
                handler ,                               
                &listInfo,                              
                info.Records_Returned ,                 
                -1 ,       
                &errorCode ) ; 
                                 
       ptr = r2  ;                                                     
       for ( int i =0 ; i < info.Total_Records ; i ++ ) {                   
             printf ( "Number:[%d] n" , ((YASP0100_t *) ptr )-> Number ) ; 
             ...
    
    415 pointsBadges:
    report
  • TomLiotta
    Be aware that this cannot return more than 16 records. If you ever need more, you'll either need a sufficiently larger receiver variable or enough calls to QGYGETLE to get remaining records. In any case, you probably should call the Close List (QGYCLST) API after you're done receiving the list. Tom
    125,585 pointsBadges:
    report
  • TomLiotta
    Sorry, ignore much of my previous comment. I glossed right over your use of QGYGTLE. Too often eyes see what they expect to see. Tom
    125,585 pointsBadges:
    report
  • GraceP
    Thanks again !
    415 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following