|
message: 7 date: Thu, 25 Sep 2003 18:32:58 -0500 from: "Norbut, Jim" <Jim.Norbut@xxxxxxxxxxxxxxx> subject: QSYRUSRI API Has anyone had the occasion to use this API in a CL ? I am trying to create a CL that scans through each user profile and then based on the # of days till the password expires it sends a message to them. I basically just do a dspusrprf to an outfile and then do a dcl on the outfile....and from there hopefully use this API to get the # of days till it expires. Anyone have any examples they can share ? even an RPG example would work....but my RPG skills are somewhat basic at this point I am leaning slowly. Jim REPLY: This is fairly long, but perhaps it will help. ************************************************************************** * PROGRAM-$RTVUSRPRF calls API to return all information on a user * This uses the 'double-call' technique to find the correct size of the * receiver variable. Then you allocate that much space and call the API * again with the variable that is the corect size. This is a little * slower, but ensures that the API will run even if the API is enhanced * in future releases. ************************************************************************** * DATA DEFINITIONS FOR APIs * ************************************************************************** DQSYI0300 DS Based(ReceivePtr) * Qsy USRI0300 D QSYBRTN02 1 4B 0 * Bytes Returned D QSYBAVL02 5 8B 0 * Bytes Available D QSYUP03 9 18 * User Profile D QSYPS00 19 31 * Previous Signon (CYYMMDDHHMMSS) D QSYRSV103 32 32 * Reserved 1 D QSYSN00 33 36B 0 * Signon attempts sine last successful signon D QSYUS02 37 46 * User Status D QSYPD02 47 54 * 8 byte binary field Password change date (*DTS format) D QSYNP00 55 55 * No Password Y/N D QSYRSV203 56 56 * Reserved 2 D QSYPI01 57 60B 0 * Pwdexp Interval -1=*NOMAX, 0=QPWDEXPITV(sysval D QSYPD03 61 68 * Pwdexp Date D QSYPD04 69 72B 0 * Pwdexp Days D QSYPE00 73 73 * Password To Expired Y/N D QSYUC00 74 83 * User Class * the following is special authority flags D SpecAuth 84 91 DIM(8) D QSYAOBJ01 84 84 * All Object D QSYSA05 85 85 * Security Admin D QSYJC01 86 86 * Job Control D QSYSC01 87 87 * Spool Control D QSYSS02 88 88 * Save System D QSYRVICE01 89 89 * Service D QSYAUDIT01 90 90 * Audit D QSYISC01 91 91 * Io Sys Cfg D QSYERVED10 92 98 * Reserved * end of special authority flags D QSYGP02 99 108 * Group Profile D QSYOWNER01 109 118 * Owner *GRPPRF D QSYGA00 119 128 * Group Auth *NONE D QSYAL04 129 138 * Assistance Level *INTERMED,etc D QSYCLIB 139 148 * Current Library D QSYNAME14 149 158 * init menu D QSYBRARY14 159 168 * init menu library D QSYNAME15 169 178 * init program D QSYBRARY15 179 188 * init program library D QSYLC00 189 198 * Limit Capabilities *NO D QSYTD 199 248 * Text Description D QSYDS00 249 258 * Display Signon *SYSVAL D QSYLDS 259 268 * Limit DeviceSsn *SYSVAL D QSYKB 269 278 * Keyboard Buffering *SYSVAL D QSYRSV300 279 280 * Reserved 3 D QSYMS 281 284B 0 * Max Storage allowed D QSYSU 285 288B 0 * Storage Used D QSYSP 289 289 * Highest Scheduling Priority 3 D QSYNAME16 290 299 * Jobd D QSYBRARY16 300 309 * Jobd Library D QSYAC 310 324 * Accounting Code D QSYNAME17 325 334 * Msgq D QSYBRARY17 335 344 * Msgq Library D QSYMD 345 354 * Msgq Delivery *NOTIFY D QSYRSV4 355 356 * Reserved 4 D QSYMS00 357 360B 0 * Msgq Severity 00 D QSYNAME18 361 370 * Outq D QSYBRARY18 371 380 * Outq Library D QSYPD05 381 390 * Print Device P1 D QSYSE 391 400 * Special Environment *NONE D QSYNAME19 401 410 * ATTN pgm D QSYBRARY19 411 420 * ATTN pgm Library D QSYLI 421 430 * Language Id *SYSVAL D QSYCI 431 440 * Country Id *SYSVAL D QSYCCSID00 441 444B 0 * Char Code Set ID -2 * The following fields are user options D UserOpt 445 451 Dim(7) D QSYSK00 445 445 * Show Keywords D QSYSD00 446 446 * Show Details D QSYFH00 447 447 * Fullscreen Help D QSYSS03 448 448 * Show Status D QSYNS00 449 449 * Noshow Status D QSYRK00 450 450 * Roll Key D QSYPM00 451 451 * Print Message D QSYERVED11 452 480 * Reserved * End of user options D QSYNAME20 481 490 * Sort Seq name *SYSVAL D QSYBRARY20 491 500 * Sort Seq Name Library D QSYOBJA18 501 510 * Object Audit *NONE * The following are User Action Audit Level D UserAct 511 523 DIM(13) D QSYCMDS00 511 511 * Command Strings D QSYREATE00 512 512 * Create D QSYELETE00 513 513 * Delete D QSYJD01 514 514 * Job Data D QSYOBJM07 515 515 * Object Mgt D QSYOS00 516 516 * Office Services D QSYPGMA00 517 517 * Program Adopt D QSYSR00 518 518 * Save Restore D QSYURITY00 519 519 * Security D QSYST00 520 520 * Service Tools D QSYSFILD00 521 521 * Spool File Data D QSYSM00 522 522 * System Management D QSYTICAL00 523 523 * Optical D QSYERVED12 524 574 * Reserved * End of User Action Audit Level D QSYGAT00 575 584 * Group Auth Type *PRIVATE D QSYSGO00 585 588B 0 * Supp Group Offset to array =660 D QSYSGNBR02 589 592B 0 * Number of Supp Groups =2 D QSYUID 593 596B 0 * UID D QSYGID 597 600B 0 * GID D QSYHDO 601 604B 0 * Offset to HomeDir D QSYHDL 605 608B 0 * Len of HomeDir D QSYLJA 609 624 * Locale Job Attributes NYNNNNNN.... D QSYLO 625 628B 0 * Offset to Locale D QSYLL 629 632B 0 * Len of Locale D QSYGMI03 633 633 * Group Members Indicator D QSYDCI 634 634 * Digital Certificate Indicato D QSYCC 635 644 * Chrid ID Control *SYSVAL *-------------------------------------------------------------------------------- D QSYasudO 645 648B 0 * Offset-ASP storage usage descriptors D QSYasudN 649 652B 0 * Offset-# of ASP storage usage descriptors D QSYasudrO 653 656B 0 * Offset-ASP storage usage descriptors returned D QSYasudrN 657 660B 0 * Offset-# of ASP storage usage descr returned *-------------------------------------------------------------------------------- *Suppliment groups array *QSYSGN02 645 654 DIM(00001) * Varying length D QSYSGN02 DS Based(SupGrpPtr) D suppg 10 DIM(15) max number allowed *-------------------------------------------------------------------------------- *Home directory EVAL QSYPI02 = %subst( QsyI0300 : QSYHDO : QSYLI00 ) *QSYPI02 655 655 from : length ) * Varying length *Locale path EVAL QSYLI00 = $subst( QSYI0300 : QSYLO : QSYLL) *QSYLI00 656 656 * Varying length *-------------------------------------------------------------------------------- D Receiver1 DS D BytesRtn1 10i 0 D BytesAvl1 10i 0 * Standard Error Code data structure DQUSEC DS 116 inz D QUSBPRV 1 4B 0 inz(116) D QUSBAVL 5 8B 0 inz(0) D QUSEI 9 15 D QUSERVED 16 16 D QUSED01 17 116 D FormatName S 8 inz('USRI0300') D pUsrProfile s 10 D ReceiveLen S 10i 0 D SgDsp s 10 D OI S 4 0 *------------------------------------------------------------------------- * Compile time tables *------------------------------------------------------------------------- D TABE1 S 1 0 DIM(8) CTDATA PERRCD(1) D TABE1A S 10 DIM(8) ALT(TABE1) D TAB2 S 1 0 DIM(7) CTDATA PERRCD(1) D TAB2A S 10 DIM(7) ALT(TAB2) D TAB3 S 2 0 DIM(13) CTDATA PERRCD(1) D TAB3A S 10 DIM(13) ALT(TAB3) *------------------------------------------------------------------------- * workfield for QWCCVTDT API convert date *------------------------------------------------------------------------- D InDateFmt S 10 D OutDateFmt S 10 D DTTM s 16 1030317075653253 *------------------------------------------------------------------------- * Work fields *------------------------------------------------------------------------- D Text S 10 D Cnt S 1S 0 spc auth index D Cnt2 S 2S 0 USERACTIONINDEX D x S 3S 0 UPSPAU D sg S 3S 0 supp grp indicator D pMsgID S 7 * Use IBM's *OUTFILE for DSPUSRPRF *BASIC to return values D pRtnParms E DS EXTNAME(QADSPUPB) c *entry Plist c Parm pUsrProfile c Parm pRtnParms return data structure c Parm pMsgid return errors * Call the api to get the information you want C Call 'QSYRUSRI' C Parm Receiver1 C Parm 8 ReceiveLen C Parm FormatName C Parm pUsrProfile C Parm QUSEI ** QUSEI is blank unless there is an error * error - return the error to previous program C IF QUSed01 <> ' ' more errors C EVAL pMsgid = QUSed01 C ELSE * Allocate enough storage for receiver * If a bad profile is passed to this progarm there will be a * 'length requested for storage allocation is out of range' error RNQ0425 * passing me a lower case profile that caused this. c Alloc BytesAvl1 ReceivePtr * Call the api to get the information you want C Call 'QSYRUSRI' C Parm QSYI0300 C Parm BytesAvl1 ReceiveLen C Parm FormatName C Parm pUsrProfile C Parm QusEc * Process the data from the API * Return values C eval UPUPRF = QSYUP03 User Profile Name C eval UPUSCL = QSYUC00 User class C eval UPDSIN = QSYDS00 Display sign-on * QSYPD02 Password change date (*DTS format) SYSTEM TIMESTAMP C exsr CVTDT *YMD for century flg C eval UPPWCC = %subst( DTTM: 1: 1) Password chg-CC C eval UPPWCD = %subst( DTTM: 2: 6) Password chg-DT C eval UPPWCT = %subst( DTTM: 9: 6) Password chg-TM C eval UPPWEI = QSYPI01 Password expiration C eval UPPWEX = QSYPE00 Password expired C eval UPPWON = QSYNP00 Password of *NONE: * QSYPS00 Previous Signon (CYYMMDDHHMMSS) C eval UPPSOC = %subst( Qsyps00: 1: 1) Prev sign-on CC C eval UPPSOD = %subst( Qsyps00: 2: 6) Prev sign-on DT C eval UPPSOT = %subst( Qsyps00: 8: 6) Prev sign-on TM C eval UPNVSA = QSYSN00 Sign-on attempts not C eval UPLDVS = QSYLDS Limit device sessio **** eval UPSPAU = Special authorities **see tables with this information flags are returned Special authorities *** QSYAOBJ01 = Y/N All Object *** QSYSA05 = Y/N Security Admin *** QSYJC01 = Y/N Job Control *** QSYSC01 = Y/N Spool Control *** QSYSS02 = Y/N Save System *** QSYRVICE01= Y/N Service *** QSYAUDIT01= Y/N Audit *** QSYISC01 = Y/N IO Sys Cfg C z-add 1 x C z-add 1 cnt C EVAL UPSPAU = *blanks C do 8 cnt C IF SpecAuth(cnt) = 'Y' C cnt LOOKUP TABE1 TABE1A 10 get description C IF *in10 = *on C MOVEL TABE1A text C eval %subst( UPSPAU : x : 10) = text C eval x = x + 10 C endif C endif C enddo C eval UPMXST = QSYMS Max storage C eval UPMXSU = QSYSU Storage used C eval UPPRLT = QSYSP Priority limit C eval UPINPG = QSYNAME15 Initial Pgm C eval UPINPL = QSYBRARY15 Initial pgm libr C eval UPJBDS = QSYNAME16 Jobd C eval UPJBDL = QSYBRARY16 Jobd library C eval UPOWNR = QSYOWNER01 Owner C eval UPGRPF = QSYGP02 Group profile C eval UPGRAU = QSYGA00 Group authority *? eval UPGRPI = Group profile indica C eval UPACCD = QSYAC Accounting code CL0N01Factor1+++++++Opcode&ExtExtended-factor2+++++++++++++++++++++++++++++Comments+++++++++++ C eval UPMGQU = QSYNAME17 Message queue C eval UPMGQL = QSYBRARY17 Message queue libr C eval UPOTQU = QSYNAME18 Output queue C eval UPOTQL = QSYBRARY18 Output Queue libr C eval UPTEXT = QSYTD Text descriptio C eval UPSPEN = QSYSE Special environ C eval UPCRLB = QSYCLIB Current library C eval UPINMN = QSYNAME14 Initial menu C eval UPINML = QSYBRARY14 Initial menu libr C eval UPLTCP = QSYLC00 Limited capabilit C eval UPDLVY = QSYMD Message queue deliv C eval UPSVRT = QSYMS00 Message queue sever C eval UPPRDV = QSYPD05 Printer device C eval UPATPG = QSYNAME19 Attention Program C eval UPATPL = QSYBRARY19 Attention program * eval UPUSOP = User options *** USER OPTIONS UPUSOP *** QSYSK00 = Y/N Show keywords *** QSYSD00 = Y/N Show details *** QSYFH00 = Y/N fullscreen help *. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... 8 ...+... 9 ...+... *** QSYSS00 = Y/N Show status *** QSYNS00 = Y/N NoShow status *** QSYRK00 = Y/N Roll key *** QSYPM00 = Y/N Print message C z-add 1 x C z-add 1 cnt C EVAL UPUSOP = *blanks C do 7 cnt C IF UserOpt(cnt) = 'Y' C cnt LOOKUP TAB2 TAB2A 10 get description C IF *in10 = *on C MOVEL TAB2A text C eval %subst( UPUSOP : x : 10) = text C eval x = x + 10 C endif C endif C enddo *? eval UPUPLK = User profile lock *? eval UPUPDM = User profile damag C eval UPSTAT = QSYUS02 Status C eval UPKBDB = QSYKB Keyboard buffering C eval UPASTL = QSYAL04 Assistance level C eval UPLANG = QSYLI Language identifie C eval UPCNTR = QSYCI Country identifier C eval UPCCSI = QSYCCSID00 Coded character set *? eval UPSRT = Sort sequence *? eval UPSRTL = Sort sequence libr C eval UPOBJA = QSYOBJA18 Object auditing val * eval UPAUDL = Action auditing val *** USER action audit level *** QSYCMDS00 = Y/N Command strings *CMD *** QSYREATE00= Y/N Create *CREATE *** QSYELETE00= Y/N Delete *DELETE *** QSYJD01 = Y/N Job Data *JOBDTA *** QSYOBJM07 = Y/N Object Mgt *OBJMGT *** QSYOS00 = Y/N Office Services *OFCSVR *** QSYPGMA00 = Y/N Program Adopt *PGMADP *** QSYSR00 = Y/N Save Restore *SAVRST *** QSYURITY00= Y/N Security *SECURITY *. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... 8 ...+... 9 ...+... 0 *** QSYST00 = Y/N Service Tools *SERVICE *** QSYFILD00 = Y/N Spool File Data *SPLFDTA *** QSYSM00 = Y/N System Management *SYSMGT *** QSYTICAL00= Y/N Optical *OPTICAL C z-add 1 x C z-add 1 cnt2 C EVAL UPAUDL = *blanks C do 13 cnt2 C IF UserAct(cnt2) = 'Y' C cnt2 LOOKUP TAB3 TAB3A 10 get description C IF *in10 = *on C MOVEL TAB3A text C eval %subst( UPAUDL : x : 10) = text C eval x = x + 10 C endif C endif C enddo C eval UPGATY = QSYGAT00 Group authority typ *** Supplemental groups *max 15 eval UPSUPG = Supplemental group * This is the pointer that will access the SUPPLEMENTAL GROUP information C Eval SupGrpPtr = %ADDR(QSYI0300) + QSYSGO00 C z-add 1 cnt offset to beginning C z-add 1 sg supplemental grp ind C EVAL UPSUPG = *blanks C do qsysgnbr02 How many are there C eval %subst( UPSUPG : sg: 10) = suppg(cnt) C eval cnt=cnt + 1 C eval sg = sg + 10 C enddo C eval UPUID = QSYUID User ID number C eval UPGID = QSYGID Group ID number C eval UPSETJ = QSYLJA Locale job attribut C eval UPCHID = QSYCC Character Identifier C END c Eval *inlr = *on *------------------------------------------------------------------------- * CVTDT1 convert *DTS field to fmt *YMD (CYYMMDDHHMMSSMMM) * 1030317 * where Century is: 1=20xx, 0-19xx * Can use returned 17 *chars and get CCYY in 2003 format instead of Century digit * But I need the digit in tis program *------------------------------------------------------------------------- C CVTDT BEGSR C Call 'QWCCVTDT' C Parm '*DTS' InDateFmt C Parm QSYPD02 C Parm '*YMD' OutDateFmt C Parm DTTM C Parm QusEc C ENDSR ** TABE1A (These needs to start in pos one of the source spec) 1*ALLOBJ 2*SECADM 3*JOBCTL 4*SPLCTL 5*SAVSYS 6*SERVICE 7*AUDIT 8*IOSYSCFG ** TAB2 1*CLKWD 2*EXPERT 3*HLPFULL 4*STSMSG 5*NOSTSMSG 6*ROLLKEY 7*PRTMSG ** TAB3 01*CMD 02*CREATE 03*DELETE 04*JOBDTA 05*OBJMGT 06*OFCSVR 07*PGMADP 08*SAVRST 09*SECURITY 10*SERVICE 11*SPLFDTA 12*SYSMGT 13*OPTICAL
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.