• The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
Menu
  • The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
  • Everybody Likes Shortcuts! Part 2, Playing With Blocks

    January 27, 2015 Susan Gantner

    In my last tip on RSE shortcuts, I talked about shortcuts that help you find your way as you navigate through source members. Eventually, you find the place where you need to work with the code. So in this tip, I’ll concentrate on shortcuts to help with that, and specifically working with blocks of code.

    First let’s talk about selecting a block of code. There are many ways: You could drag your mouse over the block or hold down the Shift key and use the cursor arrow down key to select the lines for the block. The one I’ve found most useful, however, is the Alt+L shortcut key.

    Alt-L–used once–selects the current line in the editor. I find this a better way to select a line for copy/paste purposes than mouse or cursor arrow keys because it always se-lects the entire line, not just a portion of it. When pasting a portion of a line in RPG, particularly fixed-format RPG, it can be tricky to position the cursor before the paste to ensure that the columns line up correctly. Using Alt-L followed by Ctrl+C (copy) I can then move to the line where I want to paste it, use the Home key to ensure I’m in the first column of that line and then paste (with Ctrl+V). Note the RDi editor will insert the pasted line before the line where you positioned. There is no need to insert a blank line to accept the pasted code.

    Alt-L can be even handier when selecting a block of code for copy and paste. Simply use Alt-L on the first line of the block and then Alt-L again on the last line of the block you wish to select. As before use Ctrl+C, Home, and Ctrl+V to insert the lines. Since the lines will be inserted (it will not overlay the code that’s already there), there’s no need to guesstimate the number of blanks lines you’ll need before the paste.

    Some of you may be wondering why I don’t just use the SEU line commands C/CC and A or B. The answer is that I often do use those. Sometimes it seems easier to use the line commands and other times I find it easier to use the clipboard. But it’s important to know both ways of copying a block of code because the line command option is only available within a single source member. To copy a block of code from one source member to another in RSE, I must use the clipboard and copy/paste.

    Here’s another use for a block selected via Alt-L. If you’re working in one of those shops where people never delete a line of code but instead comment out the old code, here’s a way to comment a lot of code very quickly. Select a block of RPG code using Alt-L (or any other method you choose) and then use the Ctrl+/ shortcut key to comment out the block of code. The editor will figure out whether the appropriate comment method is * or // and you can customize whether it overlays or shifts the rest of the code by using preferences for the ILE RPG parser. The Ctrl+ shortcut will perform the reverse action, i.e., it will un-comment the selected block of code.

    Both Ctrl+/ (comment) and Ctrl+ (uncomment) work on individual lines of code as well as blocks. In that case it’s not necessary to select the line. It will just affect the line where your cursor is.

    Here’s another interesting way to use a selected block in the editor. Have you ever had the situation while editing code with free format-logic that you need to add a level of nesting which requires shifting blocks of the existing code to indent the logic correctly? Next time you need to do that, give this a try.

    Select the code block to be shifted using Alt+L at the beginning and end of the block. Then use Alt+F8 to shift the entire block one character to the right. Repeat for as many times as needed. Alt+F7 is similar, but shifts the block left. Much more fun than using the old RR and LL line commands!

    I hope you will find these shortcuts as handy as I have. Feel free to either download a PDF of my Favorite Keyboard Shortcuts card or request a hard copy via email from the System i Developer website.

    Susan Gantner is half of Partner400, a consulting company focused on education on modern programming and database techniques and tools on the IBM i platform. She is also a founding partner in System i Developer, a consortium of System i educators and hosts of the RPG & DB2 Summit conferences. Susan was a programmer for corporations in Atlanta, Georgia, before joining IBM. During her IBM career, she worked in both the Rochester and Toronto labs, providing technical support and education for application developers. Susan left IBM in 1999 to devote more time to teaching and consulting. Together with Jon Paris, she now runs Partner400, and appears regularly at many technical conferences, including System i Developer’s RPG & DB2 Summit. Send your questions or comments for Susan to Ted Holt via the IT Jungle Contact page.

    RELATED STORY

    Everybody Likes Shortcuts! Part 1, Navigation

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Tags:

    Sponsored by
    WorksRight Software

    Do you need area code information?
    Do you need ZIP Code information?
    Do you need ZIP+4 information?
    Do you need city name information?
    Do you need county information?
    Do you need a nearest dealer locator system?

    We can HELP! We have affordable AS/400 software and data to do all of the above. Whether you need a simple city name retrieval system or a sophisticated CASS postal coding system, we have it for you!

    The ZIP/CITY system is based on 5-digit ZIP Codes. You can retrieve city names, state names, county names, area codes, time zones, latitude, longitude, and more just by knowing the ZIP Code. We supply information on all the latest area code changes. A nearest dealer locator function is also included. ZIP/CITY includes software, data, monthly updates, and unlimited support. The cost is $495 per year.

    PER/ZIP4 is a sophisticated CASS certified postal coding system for assigning ZIP Codes, ZIP+4, carrier route, and delivery point codes. PER/ZIP4 also provides county names and FIPS codes. PER/ZIP4 can be used interactively, in batch, and with callable programs. PER/ZIP4 includes software, data, monthly updates, and unlimited support. The cost is $3,900 for the first year, and $1,950 for renewal.

    Just call us and we’ll arrange for 30 days FREE use of either ZIP/CITY or PER/ZIP4.

    WorksRight Software, Inc.
    Phone: 601-856-8337
    Fax: 601-856-9432
    Email: software@worksright.com
    Website: www.worksright.com

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Sponsored Links

    Profound Logic Software:  Reach Your Modernization Goals. Register for the February 25 Webinar now!
    New Generation Software:  Ask us about Query, Reporting, and Analytics. Order a FREE Trial of NGS-IQ.
    System i Developer:  Upgrade your skills at the RPG & DB2 Summit in Dallas, March 17-19

    Reader Feedback On IBM i Wish List For 2015 DB2 Enhancements, Free Form RPG, Modernization Top Rowe’s ‘Big Hits’ List

    Leave a Reply Cancel reply

Volume 15, Number 02 -- January 27, 2015
THIS ISSUE SPONSORED BY:

WorksRight Software
SEQUEL Software
System i Developer

Table of Contents

  • Everybody Likes Shortcuts! Part 2, Playing With Blocks
  • The Powerful SQL Upsert
  • Knee-Deep In Ruby Waters

Content archive

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

Recent Posts

  • Public Preview For Watson Code Assistant for i Available Soon
  • COMMON Youth Movement Continues at POWERUp 2025
  • IBM Preserves Memory Investments Across Power10 And Power11
  • Eradani Uses AI For New EDI And API Service
  • Picking Apart IBM’s $150 Billion In US Manufacturing And R&D
  • FAX/400 And CICS For i Are Dead. What Will IBM Kill Next?
  • Fresche Overhauls X-Analysis With Web UI, AI Smarts
  • Is It Time To Add The Rust Programming Language To IBM i?
  • Is IBM Going To Raise Prices On Power10 Expert Care?
  • IBM i PTF Guide, Volume 27, Number 20

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