Need to write a CL program to track user logins

15 pts.
Tags:
CL Program
CL programming
User Login Data
HI, I WANT HOW TO WRITE A CL PROGRAMME TO KNOW A USER IS LOGGED IN OR NOT.MEANS IN A SERVER NUMBER OF USERS OR THERE SO I WANT TO FIND OUT WHICH USER IS LOGIN STATE WHICH OR NOT LOG-OFF STATE.WHEN I RUN A PGM TO PROVIDE USER NAME IT WILL SHOW THE LOGIN OR LOGOFF STATUS...
ASKED: June 17, 2010  5:59 AM
UPDATED: July 3, 2010  6:01 AM

Answer Wiki

Thanks. We'll let you know when a new response is added.

Here are a couple of examples that you should be able to modify to fit your needs.

http://forums.systeminetwork.com/isnetforums/showthread.php?t=49498

http://www.rpgiv.org/QBATCHLOG.htm

Discuss This Question: 7  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
    Define "login". Do you want users who are logged into the *DATABASE server? The *DTAQ server? The *FILE server? FTP? Telnet? There are a lot of ways to "login" as a user. Tom
    125,585 pointsBadges:
    report
  • TomLiotta
    Note that QIBM_QWT_JOBNOTIFY reports when jobs start or end. Job starts do not indicate "logons" and job ends do not indicate "logoffs". Tom
    125,585 pointsBadges:
    report
  • Teandy
    Note that QIBM_QWT_JOBNOTIFY reports when jobs start or end. Job starts do not indicate “logons” and job ends do not indicate “logoffs”. Funny, I've been using it for just that purpose for a couple of years now and it works flawlessly.
    5,860 pointsBadges:
    report
  • Rayj1031
    The audit journal should contain any information that need about job's starting and ending. I created a report for a bank to show all users that signed on or off between the hours of 7:00 pm and 5:00 am using only the audit journal entry type 'JS'. The audit journal entry type 'JS' includes Start, End, Job type, job name, user, and number, real user, effective user and LOTS of other parameters. There are over 30 fields of information about job changes in the JS audit journal entry. Can you be more specific about what you are tyring to accomplish?
    335 pointsBadges:
    report
  • TomLiotta
    ...I’ve been using it for just that purpose for a couple of years now and it works flawlessly. ...As far as you know. Granted, it is possible to have it work nearly flawlessly; but if it's true for you, then you have an extremely atypical system and your method won't work for most other systems. You must:
    • ,,,nor run any host servers (or reject every logon attempt through them),
    • not run any TCP servers except telnet (or reject every logon through them)
    • don't allow logons through Windows networking,
    • no DDM nor remote SQL,
    • no Management Central,
    • no iSeries Navigator,
    • strict menu security, so only green-screen processing with no or extremely limited command-line access and tight control over commands, eliminating group jobs and a couple others,
    • and all users running in QINTER.
    It's certainly possible, but I'd guess you're close to unique. If any of those are used, then your system is handing out logons and you're missing them. Tom
    125,585 pointsBadges:
    report
  • KIRAN9SDR
    thanks for all.But i have done this earliar.Using wrkactjob to generate spool file and copy that spool file into a database file using cpysplf command in cl propgramme.take the help of substring operation choos the user values.........
    15 pointsBadges:
    report
  • TomLiotta
    If that's the only information that you needed from the system, it's much better to after it directly. Here's the source for a CHKUSRACT (Check User Active?) command:
     CHKUSRACT:  CMD        PROMPT('Check user active?')
    
                 PARM       KWD(USRPRF) TYPE(*NAME) LEN(10) MIN(1) +
                              EXPR(*YES) PROMPT('User activity to check +
                              for')
    Compile this CL as the command processing program:
    pgm    ( +
             &pChkUsr      +
           )
    
    
       dcl   &pChkUsr       *char       10
    
    
       dcl   &usrspc        *char      10  VALUE( '#$CHKUSRAC' )
       dcl   &usrspclib     *char      10  VALUE( 'QTEMP     ' )
    
       dcl   &qusrspc       *char      20
    
       dcl   &us_hdr        *char     150   /* Space header      */
    
    
    /* Number of list entries: Listed jobs...                           */
    
       dcl   &NbrLstE       *dec      (7)
    
    
    /*  The qualified search job name...                                */
       dcl   &SchJob        *char     26
    
    
       chgvar    &qusrspc        ( &usrspc *cat &usrspclib )
    
    
    /*  Create a usrspc to hold the job list data from this usrprf...   */
    
       call  QUSCRTUS         ( +
                                &qusrspc                +
                                'TMPLST    '            +
                                x'00001000'             +
                                X'00'                   +
                                '*ALL      '            +
                                'Temp list usr jobs     ' +
                                '*YES      '            +
                                x'0000000000000000'     +
                              )
    
    
    
    /*                                                                  */
    /*  Populate the usrspc with appropriate job list data...           */
    /*                                                                  */
    
       chgvar    &SchJob         ( +
                                   '*ALL      ' *cat         +
                                   &pChkUsr     *cat         +
                                   '*ALL      '              +
                                 )
    
       call  QUSLJOB          ( +
                                &qusrspc                +
                                'JOBL0100'              +
                                &SchJob                 +
                                '*ACTIVE   '            +
                                x'0000000000000000'     +
                                'I'                     +
                                x'00000000'             +
                                x'00000000'             +
                              )
    
    
    /*  Retrieve the header data...                                     */
    
       call  QUSRTVUS         ( +
                                &qusrspc                +
                                x'00000001'             +
                                x'00000096'             +
                                &us_hdr                 +
                              )
    
       chgvar    &NbrLstE        %bin( &us_hdr    133 4 )
    
    
       if ( &NbrLstE *eq 0 )  do
          sndpgmmsg  msgid( CPF9898 ) msgf( QCPFMSG ) +
                       msgdta( 'No active jobs found' )
       enddo
    
       else  if ( &NbrLstE *eq 1 )  do
          sndpgmmsg  msgid( CPF9898 ) msgf( QCPFMSG ) +
                       msgdta( 'Exactly one job found' )
       enddo
    
       else  +
          sndpgmmsg  msgid( CPF9898 ) msgf( QCPFMSG ) +
                       msgdta( 'Multiple jobs found' )
    
    
    Clean_up:
    
       dltusrspc   &usrspclib/&usrspc
    
       return
    
    endpgm
    The command accepts a user profile name. The program asks the system for a list of *ACTIVE jobs for that user, restricting the list to 'I'nteractive jobs only. When the list is returned, the number of list entries is extracted. The number is tested for zero, 1 or more jobs, and a message is sent based on the result. Just be aware that the count isn't a count of "logins". The WRKACTJOB command won't tell you about logins either, so it doesn't matter. Tom
    125,585 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