Mark Sanderson
Mark Sanderson

Reputation: 79

AS/400 QSYRUSRI API parameters

I'm trying to use the QYSRUSRI api to retrieve the number of supplemental groups in an Iseries user profile.

There is an offset pointer to the beginning of the array holding this data. The spec for format USRI0300 mentions this as starting in position 585 of the receiver variable but in my implementation that subfield (suppGrpIdx) contains zero even though the subfield for the number of supplemental groups (suppGrp) contains 6, which is correct for the profile I am analysing.

See below for my DS specifications for the received data.

Any ideas what I'm missing?

D USRI0300        DS                  based(p_usrData) qualified
D   name                        10a   overlay(USRI0300:9)      
D   prevSign                     6a   overlay(USRI0300:20)     
D   signTries                   10i 0 overlay(USRI0300:33)     
D   status                      10a   overlay(USRI0300:37)     
D   changed                      8a   overlay(USRI0300:47)     
D   expires                      8a   overlay(USRI0300:61)     
D   special                     15a   overlay(USRI0300:84)     
D   groupprf                    10a   overlay(USRI0300:99)     
D   owner                       10a   overlay(USRI0300:109)    
D   authority                   10a   overlay(USRI0300:119)    
D   initmenu                    20a   overlay(USRI0300:149)    
D   initpgm                     20a   overlay(USRI0300:169)    
D   jobd                        20a   overlay(USRI0300:290)    
D   text                        50a   overlay(USRI0300:199)    
D   suppGrpIdx                  10i 0 overlay(USRI0300:585)    
D   suppGrp                     10i 0 overlay(USRI0300:589)

Here is my Prototype:-

D QSYRUSRI        PR                  ExtPgm('QSYRUSRI')
D   RcvVar                   32767a   options(*varsize) 
D   RcvVarLen                   10i 0 const             
D   Format                       8a   const             
D   UsrPrf                      10a   const             
D   ErrCode                  32767a   options(*varsize)

Upvotes: 1

Views: 545

Answers (1)

Barbara Morris
Barbara Morris

Reputation: 3664

I tried your code, and I put %SIZE(USRI00300) as the second parameter, and I got zero for suppGrpIdx too.

As Charles and Mark Sanderson implied, you have to make the receiver big enough to give all the information and also tell the API how big the receiver is. I'm guessing that since you defined your data structure as based, that you are setting p_usrData to some larger storage. If so, give the length of the larger storage instead of the size of USRI0300.

When I set p_usrData to point to a 32767-length buffer, and put %size(buffer) as the second parameter, I got 722 for suppGrpIdx.

Upvotes: 2

Related Questions