ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Retrieve the user profile by name

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Retrieve the user profile by name

    Hi all,


    Can it possible to retrieve the user from the name ?


    Thanks

    SKMA

  • #2
    Re: Retrieve the user profile by name

    Originally posted by ris_skma
    Hi all,


    Can it possible to retrieve the user from the name ?


    Thanks

    SKMA
    RTVUSRPRF

    Goodluck

    Comment


    • #3
      Re: Retrieve the user profile by name

      this hunk of code will give you program name, user ID, number of parms (i know %parms) , job name and job number.


      Code:
           D*
           D* Program Info
           D*
           D                SDS
           D  @PGM                 001    010
           D  @PARMS               037    039  0
           D  @JOB                 244    253
           D  @USER                254    263
           D  @JOB#                264    269  0
      Try this api out also to retrive info..
      Code:
           *------------------------------------------------------               
            *  Retrieve current user profile information.
            *------------------------------------------------------               
           H Option(*SrcStmt: *NoDebugIO) DftActGRP(*No)
            *
            *  Field Definitions.
            *
           d ISOdate         S               D
           d ErrorCode       S              8    inz(X'0000000000000000')
           d RCVVARLN        S              4    inz(X'00000100')
           d FORMAT          S              8    inz('JOBI0600')
           d JOBQ            S             26    inz('*')
           d JOBID           S             16
      
            *
           dTheData          DS
            *
            * Bytes Return
            *
           d QUSBR05                 1      4B 0
            *
            * Bytes Avail
            *
           d QUSBA05                 5      8B 0
            *
            * Job Name
            *
           d QUSJN08                 9     18
            *
            * User Name
            *
           d QUSUN07                19     28
            *
            * Job Number
            *
           d QUSJNBR07              29     34
            *
            * Int Job ID
            *
           d QUSIJID05              35     50
            *
            * Job Status
            *
           d QUSJS14                51     60
            *
            * Job Type
            *
           d QUSJT08                61     61
            *
            * Job Subtype
            *
           d QUSJS15                62     62
            *
            * Job Switch
            *
           d QUSJS16                63     70
            *
            * End Status
            *
           d QUSES00                71     71
            *
            * Subsys Name
            *
           d QUSSN00                72     81
            *
            * Subsys Lib
            *
           d QUSSL06                82     91
            *
            * Curr Usrprf Name
            *
           d QUSCUN                 92    101
            *
            * Dbcs Enabled
            *
           d QUSDE                 102    102
            *
            * Exit Key
            *
           d QUSEK                 103    103
            *
            * Cancel Key
            *
           d QUSCK00               104    104
            *
            * Product Return Code
            *
           d QUSPRC                105    108B 0
            *
            * User Return Code
            *
           d QUSURC                109    112B 0
            *
            * Program Return Code
            *
           d QUSPGMRC              113    116B 0
            *
            * Special Environment
            *
           d QUSSE02               117    126
            *
            * Device Name
            *
           d QUSDN                 127    136
            *
            * Group Profile Name
            *
           d QUSGPN                137    146
           d QUSGRP                        10    DIM(00015)
           d  QUSGN00                      10    OVERLAY(QUSGRP:00001)
            *
            * Job User ID
            *
           d QUSJUID               297    306
            *
            * Job User ID Setting
            *
           d QUSJUIDS              307    307
            *
           c                   call      'QUSRJOBI'
           c                   parm                    TheData
           c                   parm                    RCVVARLN
           c                   parm                    FORMAT
           c                   parm                    JOBQ
           c                   parm                    JOBID
           c                   parm                    ErrorCode
            *
           c                   eval      *Inlr = *on
      All my answers were extracted from the "Big Dummy's Guide to the As400"
      and I take no responsibility for any of them.

      www.code400.com

      Comment


      • #4
        Re: Retrieve the user profile by name

        Hi,

        Suppose my name is "Sanjib Kumar" and my user Id is "SKMB". Now i want to retrive the User ID "SKMB" by giving the name Sanjib Kumar.

        Thanks,

        SKMA

        Comment


        • #5
          Re: Retrieve the user profile by name

          Why would you be retrieving by name--rather than ID. ID cannot be changed, while a name can (either in the User profile or the source you're getting the name from) and thus no sure way to get the proper ID. And it's possible a person could have more than one ID (or the name is generic enough to apply to more than one ID). The only way you can be sure to get a hit on the the right User profile, is to do it by ID.

          Comment


          • #6
            Re: Retrieve the user profile by name

            Well, if your user name is in the text field of your user ID and it is spelled the same you can search a user profile file for a match. There is probably a file in QSYS somewhere or you can create your own by using DSPUSRPRF to a file

            There is also likely an API somewhere out there. You can check at IBM


            You will have to be sure and show all matches.

            If you create your user profiles using a specific method, Last name + first initial or some other way you can probably figure it out and not have to look anything up

            Comment

            Working...
            X