|Editors:||Ted Holt||Managing Editor:||Mari Barrett|
|Howard Arner||Technical Editor:||David Morris|
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?
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:
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.
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.)
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
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.
Please see our advertising opportunities and pricing at
Or contact Timothy Prickett Morgan at
Phone: 212 942 5818
If you have a tough problem, our gurus can probably help. Their mailboxes are always open.
* Email Ted Holt at email@example.com
* Email Howard Arner at firstname.lastname@example.org
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.