• The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
Menu
  • The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
  • Parameterized RUNSQLSTM with Two or More Substitutions

    September 4, 2002 Timothy Prickett Morgan

    Hey, Ted:

    In the June 21 issue of Midrange Guru, you shared a Qshell sed command to create a source member that can be used under the Run SQL Statement (RUNSQLSTM) command.

    Your example replaced one token. However, I need to make multiple changes using one sed command. For example, this is the pattern source member:

     Insert into MyFile                
         ( Select distinct a.LOGNBR       
           from File1 a, File2 b    
           Where a.ORGLOGNBR = 'LLLLLLL'  
             and b.LOGNBR    = 'LLLLLLL'  
             and b.SEQNBR    =  NNNN      
             and a.CNTL = b.CNTL )        
    

    I want to change LLLLLLL and NNNN together with one sed command. Otherwise I have to create two new members.

    Is it possible to change both at the same time with one sed command?

    — Shafiq

    Use the -e option, Shafiq. The -e option indicates that a sed command follows in the next parameter. You can repeat the -e option.

    The following sed command contains two sed substitution commands, each one of which is preceded by the -e option.

    sed -e 's/LLLLLLL/1234567/g' -e 's/NNNN/9876/g'  
    /qsys.lib/mylib.lib/mysrcfile.file/mymbr.mbr  
    

    If I run this sed command against the source code you provided me, this is the output I get.

     Insert into MyFile                  
         ( Select distinct a.LOGNBR      
           from File1 a, File2 b         
           Where a.ORGLOGNBR = '1234567' 
             and b.LOGNBR    = '1234567' 
             and b.SEQNBR    =  9876     
             and a.CNTL = b.CNTL )      
    

    If I remember correctly, this option didn’t work for me when I tried it under V4R5. It does work correctly under V5R1.

    This is a good illustration of why I started learning to use Qshell. I was intrigued by the Qshell utilities and wondered if I might be able to use them with source physical files.

    — Ted

    Sponsored By
    COMMON

    REGISTER FOR COMMON IN DENVER, OCT. 13-17

    Get the IT training you need by attending COMMON Users Group’s Fall 2002 IT Education Conference & Expo, October 13-17 in Denver. Early Bird registration is $1,150 until September 4.

    Choose from over 720 sessions and labs covering a wide range of industry topics. Also receive training from J.D. Edwards, MAPICS, and other vendors.

    Don’t miss out! Go to www.common.org

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Tags: Tags: mgo_rc, Volume 2, Number 67 -- September 4, 2002

    Sponsored by
    VISUAL LANSA 16 WEBINAR

    Trying to balance stability and agility in your IBM i environment?

    Join this webinar and explore Visual LANSA 16 – our enhanced professional low-code platform designed to help organizations running on IBM i evolve seamlessly for what’s next.

    🎙️VISUAL LANSA 16 WEBINAR

    Break Monolithic IBM i Applications and Unlock New Value

    Explore modernization without rewriting. Decouple monolithic applications and extend their value through integration with modern services, web frameworks, and cloud technologies.

    🗓️ July 10, 2025

    ⏰ 9 AM – 10 AM CDT (4 PM to 5 PM CEST)

    See the webinar schedule in your time zone

    Register to join the webinar now

    What to Expect

    • Get to know Visual LANSA 16, its core features, latest enhancements, and use cases
    • Understand how you can transition to a MACH-aligned architecture to enable faster innovation
    • Discover native REST APIs, WebView2 support, cloud-ready Azure licensing, and more to help transform and scale your IBM i applications

    Read more about V16 here.

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    A Fuzzy Search Algorithm Reader Feedback and Insights: Copying Records in RPG

    Leave a Reply Cancel reply

MGO Volume: 2 Issue: 67

This Issue Sponsored By

    Table of Contents

    • Reader Feedback and Insights: Odds and Ends Always Popular
    • Starting the Host Database Server Daemon After an OS/400 V5R1 Upgrade
    • Parameterized RUNSQLSTM with Two or More Substitutions

    Content archive

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

    Recent Posts

    • Liam Allan Shares What’s Coming Next With Code For IBM i
    • From Stable To Scalable: Visual LANSA 16 Powers IBM i Growth – Launching July 8
    • VS Code Will Be The Heart Of The Modern IBM i Platform
    • The AS/400: A 37-Year-Old Dog That Loves To Learn New Tricks
    • IBM i PTF Guide, Volume 27, Number 25
    • 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

    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