|
Qshell's Black Hole
Hey, Ted:
A Qshell script displays unneeded and unwanted error messages. Can I eliminate them?
Here is an example of what I'm talking about. In the following script fragment, I want to set the value of variable BackupWasMade to either Y or N.
if cp ediinput ./backup
then BackupWasMade='Y'
else BackupWasMade='N'
fi
If the copy succeeds, BackupWasMade is set to Y, and everything's great. If the copy fails, BackupWasMade is set to N, but I see a message ("cp: 001-2113 Error found getting information for object ediinput. No such path or directory.") on the display. Can I suppress the message?
--Tim
As of V5R1, the Integrated File System has a special way to eliminate unwanted output. It's a file called /dev/null. Anything you write to this file disappears for eternity.
The cp utility routes the error message to the standard error device (stderr), which is designated by file handle 2. The solution to your problem is to redirect stderr to /dev/null. If the copy fails, you won't get the annoying message.
if cp ediinput ./backup 2>/dev/null
then BackupWasMade='Y'
else BackupWasMade='N'
fi
Use of /dev/null is not limited to Qshell. Since it's an IFS file, it's available to any programming language. Another interesting thing is that you can use /dev/null as an input file. It's always read as an empty file.
--Ted
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
E-mail: software@worksright.com
Web site: www.worksright.com
|
|
Editors
Howard Arner
Joe Hertvik
Ted Holt
David Morris
Shannon O'Donnell
Managing Editor
Shannon Pastore
Publisher and
Advertising Director:
Jenny Thomas
Advertising Sales Representative
Kim Reed
Contact the Editors
Do you have a gripe, inside dope or an opinion?
Email the editors:
editors@itjungle.com
|