WorksRight



HOME    SUBSCRIBE

  Midrange Guru - OS/400 Edition

 

Editors: Ted Holt      Managing Editor: Mari Barrett
Howard Arner Technical Editor: David Morris

    Tramenco

    Topics Covered in Volume 1, Number 24:

    Looking for Strings in the IFS

    Hey, Ted:

    I know how to find a character string in my source code. I use PDM. Is there a way I can search for character strings in OS/400 IFS files?

    -- Jack

    Sure, use grep. It's one of those Unix thingies. The name comes from a search command with parameters used in the ed text editor.

    First, start Qshell using either form of the Start Qshell command: STRQSH or QSH. You'll get a screen that looks something like the command entry screen that you get when you call QCMD.

    Let's say you want to find all instances of the word class in files with an extension of .java. (I'm using this as my example, since anybody who has Java source code should get some hits.)

    grep   'class'    *.java
    

    You may have to include a path, like the following:

    grep   'class'    /home/smith/*.java
    

    If you want to find the word regardless of the case, add the -i option:

    grep   -i    'class'    *.java
    

    Here are some other options you might find useful:

    -c
    counts the matching lines
    -n
    displays the line number before each line
    -l
    lists the file names rather than the matching lines; this is a lowercase "ell", not the digit or number one (1)
    -v
    selects non-matching lines; v comes from 'invert'

    To specify more than one option, combine them behind a single hyphen (-). This grep statement lists lines and their line number in Java files containing the string class:

    grep -ni  'class' *.java
    

    To get a summary of the options, type grep (without parameters) and press Enter.

    For more information about grep, visit http://www.gnu.org/software/grep/grep.html.

    -- Ted

     

    SPONSORED BY WORKSRIGHT SOFTWARE, INC.

    ******** Indiana and Arkansas have new area codes! ********

    On January 15, 2002, parts of area code 219 in Indiana will be split into new area codes: 260 and 574. On January 19, 2002, parts of area code 501 in Arkansas will become new area code 479.

    How are you going to update your customer files?

    We have the answer. Our ZIP/CITY System for the AS/400 can automatically update your customer files for this area code split and future ones as well.

    We provide bimonthly updates that contain all the latest area code and ZIP CODE information. The ZIP/CITY System also provides city, state and county names, county codes, time zones, and lat/lon information. The ZIP/CITY System also includes a distance calculation feature and a nearest dealer locator system.

    Software, data, bimonthly updates, and unlimited support are included for the low price of $395 per year.

    Visit our Web site http://www.worksright.com to learn more about ZIP/CITY. We offer a free, no-hassle, 30-day trial. Phone, fax, e-mail us, or order your free trial directly from our Web site.




    Reader Feedback and Insights

    Hey, Ted:

    Thank you very much for the hint on how to position the cursor on an HTML page (Midrange Guru OS/400, November 30, 2001). This has been driving me nuts for some time, and all the HTML experts I asked said it could not be done.

    You have certainly proved your superiority over these HTML experts. (It takes a guy in the AS/400 world to figure this stuff out.)

    -- Jim

    RPG Compiler Directives and SQL

    Hey, Ted:

    Bill sent a note to you--
    see Midrange Guru OS/400 Edition, December 12, 2001, Feedback section --about conditional copy not working with SQL. It works all right if you use /INCLUDE instead of /COPY. The /INCLUDE directive was introduced officially in V5R1, but it's available back to V4R2 with PTFs. Be aware that SEU doesn't like /INCLUDE in V4R4 or before, but the compiler will accept /INCLUDE.

    With /INCLUDE, SQL doesn't expand the copy member, but instead just passes the /INCLUDE on to the compiler. The compiler sees the /INCLUDE and opens the copy member. So SQL doesn't see all the things in copy members that it doesn't like (like nested /copy and all the stuff that's supposed to be conditionally excluded).

    You can use /INCLUDE everywhere you use /COPY; for both SQLRPGLE and RPGLE programs. /COPY is only required when the copy file contains things that SQL needs to see, like host variables or embedded SQL.

    These are the PTFs:

    V4R5 system: use SF62167 for TGTRLS *CURRENT, *PRV, V4R4M0 or use SF63132 for TGTRLS V4R3M0 and V4R2M0

    V4R4 system: use SF62167 for TGTRLS *CURRENT or use SF63132 for TGTRLS *PRV, V4R3M0, V4R2M0

    V4R3 system: use SF61918 for TGTRLS *CURRENT, *PRV, V4R2M0

    V4R2 system: use SF61918 for TGTRLS *CURRENT

    -- Barbara Morris
    RPG Compiler Development
    IBM Toronto

     

    SPONSORED BY TRAMENCO

    Introducing a New Source for Training and Mentoring

    Follow this link to a vital new source for how-to technical information: www.tramenco.com.

    Unlike companies that offer training as an afterthought, The Training and Mentoring Company (Tramenco) is dedicated to just one thing: Advancing your career by giving you the skills you need to solve real-world business problems.

    You get the best information from the world's leading experts--Howard Arner, Kelly Conklin, Don Denoncourt, Susan Gantner, Skip Marchesani, Glen Marchesani, Shannon O'Donnell, Craig Pelke, and Richard Shaler.

    Choose from a menu of training options to fit your needs: onsite seminars, public seminars, mentoring, consulting, books, CBTs, and Web-based training.

    And make plans to attend the 2002 iSeries Connection Conference, the multi-day, multi-track conference that was the only sold-out iSeries training event this year, co-sponsored by the Education Connection and Tramenco.

    For more information about Tramenco's career enhancing opportunities, call (800) 421-8031 or go to www.tramenco.com.




    Subscription and Advertising Information

    Subscription Information

    To unsubscribe, change your email address, or sign up for any of Guild Companies, Inc's free email newsletters, visit http://www.itjungle.com. Hit the SUBSCRIBE button on the homepage and it will lead you to our online subscription system.

    When you sign up for one of our e-newsletters, you can be assured that your e-mail address will NEVER be sold to an outside company.

    Advertising Information

    Please see our advertising opportunities and pricing at

    http://www.itjungle.com/advertising.html

    Or contact Timothy Prickett Morgan at

    Phone: 212 942 5818

    Email: tpm@itjungle.com

    Contact the Editors

    If you have a tough problem, our gurus can probably help. Their mailboxes are always open.

    * Email Ted Holt at tholt@itjungle.com

    * Email Howard Arner at harner@itjungle.com

    WorksRight

    Copyright (C) 2002 Guild Companies, Inc. All Rights Reserved.

    This document may be redistributed freely and enthusiastically by email, but only in its unedited form. Thanks for your cooperation.

    Midrange Guru is a registered trademark of Guild Companies, Inc. IBM, AS/400, iSeries, OS/400, and eServer registered trademarks of International Business Machines Corp. All other product names are trademarked or copyrighted by their respective holders.