• The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
Menu
  • The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
  • Determining Whether a User Is Already Signed On, Take Two

    June 21, 2002 Timothy Prickett Morgan

    Hey, Ted:

    I am writing in reference to the first question and answer that was published in the May 31 “Odds and Ends” column. A reader asked the following: “Is it possible for an initial program to determine if the user who is running it is already signed on with another session?”

    The technique that you described for setting an object lock is common, and it was probably adequate for the situation portrayed in the original question. However, the object-lock technique doesn’t tell you anything except ‘This object is/is not locked right now.’ Conceivably, locks can be established by users other than the one being tested. Backups might be running against the user’s library. Locks can come from many sources. This behavior could possibly even be used to bypass some level of application security.

    When a more-robust solution is required, you could use the List Job (QUSLJOB) API, as illustrated in the following CL program, which I call CHKACTUSR. Pass to it the user profile name in the first parameter, and it will return the number of active jobs for that user in the second parameter:

    ChkActUsr:  pgm      ( +
                            &pChkUsr      +
                            &pNbrLstE     +
                          )
    
    
       dcl   &pChkUsr       *char      10
    
    /* Number of list entries: Listed jobs...              */
    
       dcl   &pNbrLstE      *dec      (7)
    
    
    /*-----------------------------------------------------*/
    
       dcl   &usrspc     *char   10  VALUE( '#$CHKUSRAC' )
       dcl   &usrspclib  *char   10  VALUE( 'QTEMP     ' )
    
       dcl   &qusrspc    *char   20
    
       dcl   &us_hdr     *char  150   /* Space header  */
    
    /*  The qualified search job name...                   */
       dcl   &SchJob        *char     26
    
    
       monmsg    cpf0000      exec(goto error_rtn)
    
    /*-----------------------------------------------------*/
    
       chgvar  &qusrsp  ( &usrspc *cat &usrspclib )
    
    
    /* Create usrspc to hold active job data from this usrprf */
    
       call  QUSCRTUS         ( +
                                &qusrspc              +
                                'TMPLST    '            +
                                x'00001000'             +
                                X'00'                   +
                                '*ALL      '            +
                                'Temp list usr jobs     ' +
                                '*YES      '            +
                                x'0000000000000000'     +
                              )
    
    
    
    /*                                                     */
    /*  Populate 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    &pNbrLstE     %bin( &us_hdr    133 4 )
    
    /*------------------------------------------------------*/
    
    Clean_up:
    
       dltusrspc   &usrspclib/&usrspc
       return
    
    /*------------------------------------------------------*/
    /*                                                      */
    /*  Unexpected error                                    */
    /*                                                      */
    
    Error_rtn:
    
       chgvar      &pNbrLstE       -1
       monmsg      (cpf0000 mch0000)
       return
    
    endpgm
    

    — Tom Liotta, The Powertech Group, Inc.

    Sponsored By
    CENTERFIELD TECHNOLOGY

    Take the guesswork out of iSeries DASD Management with disk/HUNTER

    Why wait until your system slows down or stops because a run-away query eats up your disk space?

    Many application and database problems can lead to disk spikes, including:

    • Database queries that create large, temporary indexes (access paths)
    • Database queries that create large temporary spaces to implement hash joins or grouping
    • Applications that use heap storage but do not free it (memory leaks)
    • Java-based applications that create a large number of objects but that do not get reclaimed because of dangling object references
    • Applications that use the Integrated File System (IFS) and create large stream files but do not always delete them when they are done
    • Users who create copies of data in IFS as backups not realizing how much disk space they consume
    • Jobs caught in an infinite loop writing printing and creating very large spool files
    • Applications that write to log files that do not get cleared often or at all
    • Data collected by IBM performance and trace tools

    Once installed and configured, disk/HUNTER runs continuously in the background on your AS/400 iSeries, and “wakes up” at intervals that you specify. Every time disk/HUNTER wakes up, it will measure the amount of free space remaining within specified ASPs or all ASPs.

    When the amount of free space decreases by a user-specified percentage or by a user-specified amount (in megabytes or gigabytes), disk/HUNTER will go to work, generating messages and reports pointing to the origination of the spike.

    The combination of detection and diagnostic capabilities within disk/HUNTER provides a powerful element of control to iSeries shops that experience high levels of activity and that also need to be proactive in managing storage.

    To really see how disk/HUNTER can be both an insurance policy and a time-saver in your shop, click here to download a demo or order a no-charge 30-day support-assisted trial evaluation.

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Tags: Tags: mgo_rc, Volume 2, Number 48 -- June 21, 2002

    Sponsored by
    DRV Tech

    Get More Out of Your IBM i

    With soaring costs, operational data is more critical than ever. IBM shops need faster, easier ways to distribute IBM applications-based data to users more efficiently, no matter where they are.

    The Problem:

    For Users, IBM Data Can Be Difficult to Get To

    IBM Applications generate reports as spooled files, originally designed to be printed. Often those reports are packed together with so much data it makes them difficult to read. Add to that hardcopy is a pain to distribute. User-friendly formats like Excel and PDF are better, offering sorting, searching, and easy portability but getting IBM reports into these formats can be tricky without the right tools.

    The Solution:

    IBM i Reports can easily be converted to easy to read and share formats like Excel and PDF and Delivered by Email

    Converting IBM i, iSeries, and AS400 reports into Excel and PDF is now a lot easier with SpoolFlex software by DRV Tech.  If you or your users are still doing this manually, think how much time is wasted dragging and reformatting to make a report readable. How much time would be saved if they were automatically formatted correctly and delivered to one or multiple recipients.

    SpoolFlex converts spooled files to Excel and PDF, automatically emailing them, and saving copies to network shared folders. SpoolFlex converts complex reports to Excel, removing unwanted headers, splitting large reports out for individual recipients, and delivering to users whether they are at the office or working from home.

    Watch our 2-minute video and see DRV’s powerful SpoolFlex software can solve your file conversion challenges.

    Watch Video

    DRV Tech

    www.drvtech.com

    866.378.3366

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    LAYOUT: An Improved DSPFFD Searching Message Text

    Leave a Reply Cancel reply

MGO Volume: 2 Issue: 48

This Issue Sponsored By

    Table of Contents

    • RPG II
    • Determining Whether a User Is Already Signed On, Take Two
    • Parameterized RUNSQLSTM

    Content archive

    • The Four Hundred
    • Four Hundred Stuff
    • Four Hundred Guru

    Recent Posts

    • And Then There Were Two: Big Blue Withdraws IBM i 7.4
    • Crossroads RMC Shows Off New AI Dashboard at inPOWER 2025
    • Guru: When Attention Turns To You – Writing Your Own ATTN Program
    • Rocket Taps IDC To Assess The Benefits Of Full Scope IT Modernization
    • IBM i PTF Guide, Volume 27, Number 38
    • Positive News From The Kyndryl Mainframe Modernization Report
    • NAViGATE, inPower 2025 On Tap for September 2025
    • Guru: WCA4i And Granite – Because You’ve Got Bigger Things To Build
    • As I See It: Digital Coup
    • IBM i PTF Guide, Volume 27, Number 37

    Subscribe

    To get news from IT Jungle sent to your inbox every week, subscribe to our newsletter.

    Pages

    • About Us
    • Contact
    • Contributors
    • Four Hundred Monitor
    • IBM i PTF Guide
    • Media Kit
    • Subscribe

    Search

    Copyright © 2025 IT Jungle