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

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Tags: Tags: 5250, IBM i, QCMDSRC

    Sponsored by
    Maxava

    Migrate IBM i with Confidence

    Tired of costly and risky migrations? Maxava Migrate Live minimizes disruption with seamless transitions. Upgrading to Power10 or cloud hosted system, Maxava has you covered!

    Learn More

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • 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 Reply Cancel 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

  • 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
  • SEU’s Fate, An IBM i V8, And The Odds Of A Power13
  • Tandberg Bankruptcy Leaves A Hole In IBM Power Storage
  • RPG Code Generation And The Agentic Future Of IBM i
  • A Bunch Of IBM i-Power Systems Things To Be Aware Of
  • IBM i PTF Guide, Volume 27, Numbers 21 And 22

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