• 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 Three

    June 28, 2002 Timothy Prickett Morgan

    Hey, Ted:

    When it comes to determining whether a user was signed on to more than one session, I’d do it a little differently .

    I’d try to allocate the user’s message queue.

    That would eliminate a data area in the mix.

    — Tim

    Several people wrote in with the same suggestion, Tim.

    Most objected to creating the data area, saying it was unnecessary.

    Here is the code to do it your way:

    DCL        VAR(&FIRSTSESSN) TYPE(*LGL) VALUE('1')         
    DCL        VAR(&MSGQ) TYPE(*CHAR) LEN(10)                 
    DCL        VAR(&MSGQLIB) TYPE(*CHAR) LEN(10)              
                                                               
    RTVUSRPRF  USRPRF(*CURRENT) MSGQ(&MSGQ) MSGQLIB(&MSGQLIB) 
    ALCOBJ     OBJ((&MSGQLIB/&MSGQ *MSGQ *EXCL)) WAIT(0)      
    MONMSG     MSGID(CPF1002 CPF1085) EXEC(DO)                
       CHGVAR     VAR(&FIRSTSESSN) VALUE('0')                 
    ENDDO                                                     
    IF         COND(&FIRSTSESSN) THEN(DO)                     
       DLCOBJ     OBJ((&MSGQLIB/&MSGQ *MSGQ *EXCL))           
    ENDDO                                                     
    

    The program attempts to allocate the message queue with an exclusive lock. This only succeeds if the user is signing on to the first session. When the user signs on to a second or subsequent session, the allocation fails, setting variable &FIRSTSESSN to false.

    A reader named Mark pointed out that you should de-allocate the message queue in case other jobs need access to those messages. The de-allocation was not necessary with the original version that I presented.

    — Ted

    Sponsored By
    ADVANCED SYSTEMS CONCEPTS

    SEQUEL meets all your iSeries and AS/400 data access needs in a single, integrated solution:

    • Windows, Web or host user interfaces

  • Convert AS/400 data into PC file formats
  • E-mail or FTP query results, reports and spool files
  • Run-time prompted queries and reports for end users
  • IF-THEN-ELSE logic in queries and reports
  • Report, form and label formatting second to none
  • Easily convert date fields, character-to-numeric, numeric-to-character and other data manipulation
  • SORT or JOIN using a calculated field
  • Quick summarization of data with Tabling function
  • Run multiple SEQUEL requests as one with the SEQUEL Scripting function
  • OLAP Business Intelligence at a fraction of the cost of comparable solutions
  • Take 6 minutes to
    view a SEQUEL ViewPoint ScreenCam movie to see how simple Windows-based
    AS/400 and iSeries data access can be! In just a few short minutes, you
    can find out ways to make your job easier and improve data access throughout
    your organization. Download
    the ViewPoint movie here
    .

    For more information or a FREE trial of SEQUEL,
    call 847/605-1311 or visit Advanced Systems Concepts .

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Tags: Tags: mgo_rc, Volume 2, Number 50 -- June 28, 2002

    Sponsored by
    Rocket Software

    Unlock the full potential of your data with Rocket Software. Our scalable solutions deliver AI-driven insights, seamless integration, and advanced compliance tools to transform your business. Discover how you can simplify data management, boost efficiency, and drive informed decisions.

    Learn more today.

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Service Program Catch-22 Reader Feedback and Insights: Avoiding Object Locks

    Leave a Reply Cancel reply

MGO Volume: 2 Issue: 50

This Issue Sponsored By

    Table of Contents

    • Determining Whether a User Is Already Signed On, Take Three
    • Easy Subfile Windowing
    • Distinct File and Record Names with SQL

    Content archive

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

    Recent Posts

    • Meet The Next Gen Of IBMers Helping To Build IBM i
    • Looks Like IBM Is Building A Linux-Like PASE For IBM i After All
    • Will Independent IBM i Clouds Survive PowerVS?
    • Now, IBM Is Jacking Up Hardware Maintenance Prices
    • IBM i PTF Guide, Volume 27, Number 24
    • Big Blue Raises IBM i License Transfer Fees, Other Prices
    • Keep The IBM i Youth Movement Going With More Training, Better Tools
    • Remain Begins Migrating DevOps Tools To VS Code
    • IBM Readies LTO-10 Tape Drives And Libraries
    • IBM i PTF Guide, Volume 27, Number 23

    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