• The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
Menu
  • The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
  • Guru: QCMDEXC Makes A Good CPP

    March 22, 2021 Ted Holt

    I’m a fairly decent typist, and chances are you are, too. A person doesn’t sit at a keyboard for decades and not improve. At the same time, I don’t get paid to type, and I do everything I can to reduce the number of keystrokes I have to produce while carrying out the duties of the job.

    If you find yourself keying the same old long commands over and over — and who doesn’t? — I’ve got a tip for you. I have an easy way to reduce long commands to just a few keystrokes. Maybe it will save you wear and tear on your fingers and reduce your chances of getting carpal tunnel syndrome.

    Consider this command, which I use often in my work:

    RCLACTGRP ACTGRP(*ELIGIBLE)
    

    That’s 30 keystrokes, as I have to press the Enter key to run the command. I can reduce it by omitting the keyword.

    RCLACTGRP *ELIGIBLE
    

    That’s 21 keystrokes, still more than I want to type over and over throughout the course of a day.

    Fortunately, I can reduce this to five keystrokes. Here’s how.

    I create a source member, usually in QGPL/QCMDSRC, and load it with one CMD command and two PARMS. (If you’ve never created a command before, don’t panic. It’s just like keying CL.) Here’s the source code for my RAGE command.

    /* RAGE - Run command RCLACTGRP ACTGRP(*ELIGIBLE) */
    /* CPP is QCMDEXC */
    CMD        PROMPT('RCLACTGRP ACTGRP(*ELIGIBLE)')
    PARM       KWD(CMD) TYPE(*CHAR) LEN(27) +
                  CONSTANT('RCLACTGRP ACTGRP(*ELIGIBLE)')
    PARM       KWD(CMDLEN) TYPE(*DEC) LEN(15 5) CONSTANT(27)
    

    In the CMD command, you can type some text in the PROMPT parameter, but it’s not necessary, as you’ll never prompt the command.

    In the first PARM command, key the long command string in the CONSTANT parameter and the length of the command string in the LEN parameter.

    Define the second PARM as 15,5 packed decimal and key the length of the command string in the CONSTANT parameter.

    Now create the command, using QCMDEXC for the command-processing program.

    CRTCMD CMD(xxx/RAGE)
           PGM(QCMDEXC)
           SRCFILE(xxx/QCMDSRC)
           SRCMBR(RAGE)
    

    Now I type RAGE and press Enter — five keystrokes! — every time I need to destroy the activation groups while I’m testing.

    Here’s another example. WJ4 (“Work with Job, Option 4”) shows me the spooled files that were created in my 5250 session. This saves me from wading through pages of spooled files in the Work with Spooled Files (WRKSPLF) panel.

    /* WJ4 - Work with this job's spool files */
    /* CPP is QCMDEXC */
    CMD        PROMPT('Work with job''s spool files')
    PARM       KWD(CMD) TYPE(*CHAR) LEN(20) +
                CONSTANT('WRKJOB OPTION(*SPLF)')
    PARM       KWD(LENGTH) TYPE(*DEC) LEN(15 5) CONSTANT(20)
    

    I use these and other such commands all day long.

    Just a few more comments and I’ll be done.

    • You can start the command string with a question mark if you want to be prompted to fill in parameters.
    /* WSJ - Prompt and run WRKSBMJOB */
    /* CPP is QCMDEXC */
    
    CMD
    PARM       KWD(CMD) TYPE(*CHAR) LEN(20) +
                CONSTANT('?WRKSBMJOB')
    PARM       KWD(LENGTH) TYPE(*DEC) LEN(15 5) CONSTANT(10)
    

    Don’t forget that the command can be CALL. If you often call a program with the same parameters, creating a command can be a huge keystroke saver, even if you only use the command for one day.

    • This process is very similar to what you do when you create PDM options. The difference is that these commands run from a 5250 command line and the PDM options run from a WRKxxxPDM panel. You may want to create a command first, then put it behind a PDM option of the same name.
    • I never use these commands in production code. There’s no need to, but if there were, I’d put the “real” IBM-supplied commands in the production code.

    You do lots of nice things to help other people do their jobs more easily. Do something nice for yourself for a change.

    Share this:

    • Share on Reddit (Opens in new window) Reddit
    • Share on Facebook (Opens in new window) Facebook
    • Share on LinkedIn (Opens in new window) LinkedIn
    • Share on X (Opens in new window) X
    • Email a link to a friend (Opens in new window) Email

    Tags: Tags: 5250, IBM i, QCMDSRC

    Sponsored by
    ARCAD Software

    [IBM i Auditing Tool] Discover the Health of Your IBM i Applications in Minutes with ARCAD iCheck-up

    How well do you really know the health of your IBM i applications? Hidden complexity, unused code, and synchronization issues can make maintenance more challenging and slow down modernization efforts.

    What if you could identify these issues in just a few clicks, without installing anything on your IBM i system?

    Meet ARCAD iCheck-up, an auditing tool designed to give IBM i teams a clear, actionable overview of their applications in minutes.

    With iCheck-up, you can:

    • Assess code complexity: Identify complex source files and prioritize refactoring efforts.
    • Detect dead code: Uncover unused code that may be cluttering your applications.
    • Spot synchronization issues: Identify inconsistencies between source files and compiled objects.
    • Track code changes: Explore modification history and better understand your application’s evolution.
    • Generate a shareable report: Get a comprehensive, easy-to-read HTML report with key metrics and insights.

    Fast, simple, and secure. iCheck-up runs from Windows, requires no installation on your IBM i system, and leaves no files or code behind. Your generated report contains metrics only, keeping your source code confidential.

    Whether you’re maintaining existing applications, planning modernization, or looking to improve code quality, iCheck-up helps you make more informed decisions.

    Ready to gain deeper insights into your IBM i applications? Discover ARCAD iCheck-up and take the first step toward better code quality today!

    Share this:

    • Share on Reddit (Opens in new window) Reddit
    • Share on Facebook (Opens in new window) Facebook
    • Share on LinkedIn (Opens in new window) LinkedIn
    • Share on X (Opens in new window) X
    • Email a link to a friend (Opens in new window) Email

    It’s Harder To Hear The Pulse In The Server Market As Data Security Deteriorates, Reconsider Your Exposure

    7 thoughts on “Guru: QCMDEXC Makes A Good CPP”

    • Russ Khoury says:
      March 22, 2021 at 7:46 am

      Hi Ted, thanks for another reminder about this. I used this technique years ago to give an operator similar shortcuts that we used back in S/34-S/36 days. Like D P to show spool files, I created a shortcut DP, etc. As I’m in PDM a lot, I’ve create numerous PDM shortcuts to reduce my typing. I think you said something once about the lazy programmer – I’ve seen him, he’s in my mirror. Thanks as always for your inspiring articles.

      Reply
    • Bob Kosharek says:
      March 22, 2021 at 9:50 am

      great tip!
      You can further reduce that to 2 characters- in SEU set up an Option (F16) like ‘RG’ and then you just need to type that on any source member in your SEU screen

      Reply
    • Bob Schmalandt says:
      March 22, 2021 at 1:54 pm

      I do this for the various subsystems I like to check. So, after I’ve submitted a job, I just enter ‘QBATCH’ instead of WRKACTJOB SBS(QBATCH). I didn’t do the cool thing you did, I just created a CL called QBATCH that does WRKACTJOB, then a command, no parms, called QBATCH.

      Reply
    • Robert Clark says:
      March 22, 2021 at 8:05 pm

      Hi Ted, great tip, and one I’ve been using too. I also like your WJ4 abbreviation, hadn’t thought of that. (IE: WrkJob option 4)
      Just one restriction with this technique that I can’t see you’ve mentioned, is that CONSTANT is limited to 32 characters.

      Reply
      • Ted Holt says:
        March 23, 2021 at 10:14 am

        Thanks, Robert. I forgot all about that 32-character limitation. I should have mentioned that.

        Reply
    • Kumar G Atram says:
      March 26, 2021 at 7:32 am

      CRTPRXCMD could be an alternate approach to abbreviate long commands.

      Reply
      • Ted Holt says:
        April 19, 2021 at 11:38 am

        Yes, Kumar, and it would have the advantage of allowing us to key in parameters, unlike the technique in this article.

        Reply

    Leave a ReplyCancel reply

TFH Volume: 31 Issue: 22

This Issue Sponsored By

  • Fresche Solutions
  • New Generation Software
  • Trinity Guard
  • UCG Technologies
  • WorksRight Software

Table of Contents

  • Don’t Be A Blowhard
  • As Data Security Deteriorates, Reconsider Your Exposure
  • Guru: QCMDEXC Makes A Good CPP
  • It’s Harder To Hear The Pulse In The Server Market
  • IBM i Wish List: Add A Virtual IBM i Platform Like System z Wazi

Content archive

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

Recent Posts

  • Bob Code Assistant Gets Better Understanding Of IBM i Applications
  • IBM i In The Cloud And The Case For Reversing Replication
  • Guru: From Hiking Boots To Long-Term Memory
  • Inside IBM’s New PowerHA Cloud Offering, Full System Manager
  • IBM i PTF Guide, Volume 28, Number 39
  • Power Systems Turns In Another Great Quarter
  • Big Blue Is Right On Schedule With Fall 2026 IBM i Tech Refreshes
  • Guru: Environment Variables – Global Variables Wearing Hiking Boots
  • A New IBM i Entity Takes Shape: Power By Fortra
  • IBM i PTF Guide, Volume 28, Number 38

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