• The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
Menu
  • The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
  • Odds and Ends

    May 31, 2002 Timothy Prickett Morgan

    Dear Readers:

    As requested, here are more short tips that don’t qualify as tips in their own right, for whatever reasons. I hope you find something useful.

    ASC

    — Ted

    Question:

    Is it possible for an initial program to determine if the user who is running it is already signed on with another session?

    Answer:

    Yes, attempt to allocate an object with an exclusive lock. If the user is already signed on elsewhere, the allocation should fail.

    Here is some example code to get you started.

       DCL   &USER        *CHAR     10                 
       DCL   &LIB         *CHAR     10  VALUE(QGPL)
    
       MONMSG     MSGID(CPF0000) EXEC(GOTO ENDPGM)
    
       RTVUSRPRF  RTNUSRPRF(&USER)                        
       /* create a data area, if it doesn't already exist */
       CRTDTAARA  DTAARA(&LIB/&USER) TYPE(*LGL) 
       MONMSG     MSGID(CPF1023)
       /* Attempt to allocate the directory */
       ALCOBJ     OBJ((&LIB/&USER *DTAARA *EXCL)) WAIT(0)
       MONMSG     MSGID(CPF1002 CPF1085) EXEC(DO) 
          /* user is already signed on -- do whatever */
          GOTO SKIP
       ENDDO
       /* Call program if user is not signed on elsewhere */
       CALL SOMEPGM
    SKIP: 
    
    ENDPGM:
       ENDPGM
    

    Question:

    I wrote a Qshell script and keyed it in to a file in my home directory of the OS/400 IFS. When I try to run the script, I get error message 001-0019 (Error found searching for command myscript.qsh. No such path or directory). Yet the List directory contents (ls) Qshell command and the OS/400 Work with Links (WRKLNK) command show that the file is there. Why won’t Qshell run my script?

    Answer:

    For some reason, you do not have permission to execute the file. I have run into this occasionally. For example, if you have a Qshell command create the file, it may not have the executable attribute set.

    Use the Change Mode (chmod) command to make the file executable.

    chmod  +x  myscript.qsh
    

    Question:

    How do I make Query/400 print leading zeros for a numeric customer number field?

    Answer:

    From the Define the Query panel, place a number 1 beside the Specify report column formatting option and press the Enter key. Position the cursor to the customer number field and press F16 to specify editing. For the Editing option, choose 1 (Numeric editing choices). Change the Replace leading zeros entry to Y. You may also want to change the Decimal point and Thousands separators to 5 (None).

    Question:

    Our AS/400 nightly backup usually fits on one cartridge tape, but occasionally goes over
    to a second. Once it does, the tape in TAP01 ejects as designed. Subsequent commands in this backup job–the Save Configuration (SAVCFG) command and the Save Security Data (SAVSECDTA) command–have TAP01 and TAP02 devices specified, but under this circumstance, the job issues inquiry message CPA4086 (device TAP01 not ready) and waits for operator intervention. Since CPA4086 is an inquiry message, I cannot monitor for it.

    Can you help explain and offer suggestions as to how to use TAP02 on subsequent SAV* commands in the same job if and only if TAP01 is filled?

    Answer:

    Run the Check Tape (CHKTAP) command with ENDOPT(*LEAVE) after the first save finishes. If TAP01 has unloaded, you’ll get escape message CPF6760. If you get the escape message, do subsequent saves to TAP02.

    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 42 -- May 31, 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

    Prevent Someone Else from Peeking at Your Window 2000/XP System Proper Use of QTEMP

    Leave a Reply Cancel reply

MGO Volume: 2 Issue: 42

This Issue Sponsored By

    Table of Contents

    • A Better Way to Get Query/400 Definitions?
    • Odds and Ends
    • Using Library Lists for JDBC File Access

    Content archive

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

    Recent Posts

    • The Power11 Transistor Count Discrepancies Explained – Sort Of
    • Is Your IBM i HA/DR Actually Tested – Or Just Installed?
    • Big Blue Delivers IBM i Customer Requests In ACS Update
    • New DbToo SDK Hooks RPG And Db2 For i To External Services
    • IBM i PTF Guide, Volume 27, Number 33
    • Tool Aims To Streamline Git Integration For Old School IBM i Devs
    • IBM To Add Full System Replication And FlashCopy To PowerHA
    • Guru: Decoding Base64 ASCII
    • The Price Tweaking Continues For Power Systems
    • IBM i PTF Guide, Volume 27, Numbers 31 And 32

    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