• The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
Menu
  • The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
  • Using Grep to Search Source Physical Files

    November 13, 2002 Timothy Prickett Morgan

    Editor’s Note: You can find an update on this article here on the IT Jungle website.

    Hey, Ted:

    Thank you for your great tips. I devour them every time they arrive in my e-mail. Every question is like a mini-mystery novel. The case is out there, and I always want to know how the crime (ahem, the problem) is resolved. Even if I know the answer, it’s gratifying to see you provided a different approach to it.

    Today, however, I have a case for you.

    I want to use grep’s wonderful search capabilities from my CL programs to search source physical file members. I can call my routines using the Start QSH (STRQSH) command, but I’m puzzled about how to retrieve the results of the search. Passing parameters to QSH scripts and utilities is easy, but I can’t find how to pass information from Qshell back to the CL caller.

    — Luis

    I’m glad you enjoy the tips. Thank you for the encouragement.

    You can direct the output of grep to a disk file. The following command puts the output into member MYMBR of file MYFILE in library MYLIB.

    grep 'x*' someinputfile >/qsys.lib/mylib.lib/myfile.file/mymbr.mbr
    

    Then you can read the disk file to see whether there were any matches. Grep displays matching lines. I don’t know of any way to find out the position of the match.

    — Ted

    Thank you so much for your answer. It solves my problem. However, I am still wondering if there is some way to catch the result from a Qshell script. I am aware that Qshell scripts return a numeric value, such as zero for normal termination. For instance, if I enter the following on the command line:

    QSH CMD(xyz)
    

    I get the following message.

    Command ended normally with exit status 127.

    Do you think there is a way to catch that number?

    — Luis

    Try this solution. Substitute your library name for yourlib. Qtemp won’t work.

    crtpf yourlib/qshoutput rcdlen(256) 
    
    crtpf yourlib/qsherror  rcdlen(256) 
    
    QSH CMD('(xyz ; print $? >/qsys.lib/yourlib.lib/qshoutput.file/
            qshoutput.mbr) 
    2>/qsys.lib/yourlib.lib/qsherror.file/qsherror.mbr')
    

    Qshell attempts to run the xyz command. If xyz runs normally, the return code (exit status) will have the value zero. If xyz ends abnormally, the return code will be something other than zero. The print command copies the return code to file QSHOUTPUT. Use the mechanism of your choice to read it. Any error messages will be in QSHERROR.

    — Ted

    RELATED STORY

    Search Source Members For Two Or More Strings

    Sponsored By
    WORKSRIGHT SOFTWARE

    CASS Certification

    What is it? Why do you need it?

    CASS stands for “Coding Accuracy Support System.” This is a test developed by the U.S. Postal Service to determine whether ZIP Code software can accurately assign ZIP Codes to mailing addresses. CASS-certified software is intended to improve the accuracy of carrier route, 5-digit ZIP, ZIP+4, and delivery point codes.

    CASS certified means the software has passed the test. When you use CASS software to update and maintain your mailing file, then your mailing file becomes CASS certified. What does this mean to you?

    CASS certification is the first step in qualifying for postage discounts. Look at the mail you receive at home and at work; you will see that a lot of it was mailed for less than the regular 37 cent rate.

    Despite all the glitz and glamour of the Internet, email, and such, the wheels of America’s economy are lubricated by the ordinary envelope and the U.S. Postal Service.

    If your company sends out a lot of mail, there is a good chance CASS certification can cut your postage expense. There are other steps you must perform to get these discounts, but CASS is the first step.

    Your mail must be printed, sorted, and then packaged according to postal regulations. It takes some effort, but the potential savings make it worthwhile.

    Exactly what happens when you process your mailing files with CASS software? The software breaks the address down into its individual elements: state, city, street name, and so forth. Then the information is compared to the national ZIP+4 database. If a match is found, the ZIP Code, ZIP+4, delivery point, and carrier route are assigned. Also the delivery line is standardized to comply with Postal Service preferences.

    If an address can’t be matched, no action is taken. This has the positive effect of allowing you to identify addresses in your mailing files which possibly can’t be delivered, will be delayed in delivery, or at the very minimum need some minor correction to one of the address elements.

    Using CASS certified software has many side benefits. You will be able to identify addresses that are potentially undeliverable. It has been estimated that as much as 30% of all advertising mail is never delivered.

    That means the costs of postage, printing, paper, and overhead for undelivered mail are wasted. That means if you spend $100,000 on a direct mail campaign, as much as $30,000 could be completely wasted.

    CASS software provides a number of intangible benefits. With CASS certification and bar coding there is a good likelihood that that your mail will be delivered sooner. If your invoices are delivered one day sooner, you may receive payment one day sooner.

    If you CASS certify your mailing file, you can move on to the next step which is postal automation. This means applying a POSTNET bar code.

    POSTNET is that little row of tall and short bars you see on your mail. POSTNET is a special bar code used by the Postal Service to allow automatic sorting machines to work.

    It has been reported that bar code standard class (the old third class) mail gets delivered about as soon as first class, instead of the usual 2 or 3 weeks.

    The bottom line is that using CASS software will help you keep your customers’ address information in much better shape than they would be otherwise. Your mail may be delivered sooner at less cost and that means more bottom-line dollars for your company.

    If you would like more information about CASS and CASS software,
    contact your local post office or
    call WorksRight Software, Inc., at 601-856-8337.

    Are FedEx, United Parcel, and Airborne charges
    for incorrect addresses eating into your budget?

    Every bad address can result in a $5 to $10 charge. Even seemingly small addressing errors such as misspelled street names, or missing suite numbers can result in the same penalty as if the address were totally wrong.

    Our PER/ZIP4 addressing matching software will match your addresses to the national ZIP+4 postal database. Based on the match PER/ZIP4, will update your addresses to postal standards. Our sophisticated address logic can add missing directionals, correct minor misspellings, and standardize the address format. If PER/ZIP4 can’t match the address, then you know that there is likely a serious error in the address that needs to be corrected.

    PER/ZIP4 can be used in a batch mode to update an entire file or interactively to update individual address one at a time. We provide a search function so that you can search the national ZIP+4 database to verify a specific address.

    Visit our Web site www.worksright.com for more information and to order a free, no-hassle, 30-day trial. Or call WorksRight Software, Inc., at 601-856-8337.

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Tags: Tags: mgo_rc, Volume 2, Number 87 -- November 13, 2002

    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

    Omitting Parameters in RPG Programs and Modules Reader Feedback and Insights: Indicators in RPG II Programs

    Leave a Reply Cancel reply

MGO Volume: 2 Issue: 87

This Issue Sponsored By

    Table of Contents

    • Reader Feedback and Insights: Modernizing RPG II Programs
    • Using Grep to Search Source Physical Files
    • Compiler Directives for RPG Programs and Modules

    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