fhg
Volume 8, Number 1 -- January 9, 2008

Odds and Ends

Published: January 9, 2008

by Ted Holt

Happy New Year, distinguished colleagues!

I hope everybody enjoyed the holidays and got to take some time off. Christmas was wonderful for me. I am blessed more than I deserve to be. To start off a brand new year is this collection of odds and ends. I hope you find something useful.

--Ted

Put FTP Information in One Place

1. Most shops do batch FTP this way:

OVRDBF FILE(INPUT) TOFILE(QFTPSRC) MBR(mbr_name)
OVRDBF FILE(OUTPUT) TOFILE(FTPLOG) MBR(nbr_name)
STRTCPFTP RMTSYS(ftp_server)
DLTOVR FILE(OUTPUT) LVL(*JOB)
DLTOVR FILE(INPUT) LVL(*JOB)

where QFTPSRC(mbr_name) looks something like:

user_name password
ftp command(s)
quit

This forces you to maintain the destination FTP server's name in one source member and the user profile and password in another source member.

I prefer to put the FTP server's name in the QFTPSRC(mbr_name) file:

open ftp_server
user user_name password
ftp command(s)
quit

Then, all CL programs have the same STRTCPFTP command, with a dummy FTP server name:

OVRDBF FILE(INPUT) TOFILE(QFTPSRC) MBR(mbr_name)
OVRDBF FILE(OUTPUT) TOFILE(FTPLOG) MBR(nbr_name)
STRTCPFTP RMTSYS('found in input file')
DLTOVR FILE(OUTPUT) LVL(*JOB)
DLTOVR FILE(INPUT) LVL(*JOB)

And the CL program does not have to be changed if the name of the FTP server changes.

Editor's note: This makes a lot of sense to me. I like simple little tips like this one.


 

Debugger Displays Blanks or Zeros

Question: I am debugging a program with the full-screen (green-screen) debugger. After a read, I use F11 to view the values of the fields in the record just read. I see the values of some of the fields, but other fields display as blanks or zero, even though they are not blank or zero in the database. Why?

Answer: If you look at the compiler listing, you will see that some fields were flagged with error 7031. This error indicates that the fields are not used in the program, therefore the compiler did not allocate memory for them. For this reason, the debugger cannot display their values.


 

Another Way to Count IFS Files

I have a recommendation on other ways to obtain a file count in the IFS.

The ls command is in many ways the match to the DOS dir command many are familiar with, but at times the better alternative may be to use the find command. Using find allows more flexibility if one wants to specify specific patterns to count. The command find * | wc -l provides a count of all objects in the current directory as well as any subdirectories.

Be aware that the subdirectories themselves each count as one object. The base of the count can be changed from the current directory by justifying the desired directory in the find command, i.e. find /home/mydir | wc -l. If you only wanted to count files in that tree with 2007 in the file name, the command would be changed to find /home/mydir -name *2007* | wc -l.

The find command has a number of other switches that can be useful. IBM lists these in the Info Center documents. Here is the link to the v5r3 version:

http://publib.boulder.ibm.com/infocenter/iseries/v5r3/index.jsp?topic=/rzahz/find.htm

--Craig

Editor's note: Craig's tip is in response to the second tip in the November 14, 2007, Odds and Ends.


 

Yet Another Way to Count IFS Files

The task of checking to see if a directory contains files or not can be accomplished in CL with the CHECK IN (CHKIN) command. Just monitor for message CPFA093. (Name matching pattern not found.)

--Jørn

Editor's note: I don't doubt that this works, but what if someone checks in something that should remain checked out?(Inquiring minds want to know.)


 

Query Can't Allocate a Printer

Question: Query/400 sent two messages we've never seen before.

  • CPF4128: Not able to allocate objects needed for file QPQUPRFIL in library QSYS member or program device ZZZPRT
  • CPF5729 Not able to allocate object ZZZPRT

To our knowledge, we have not changed the query or the RUNQRY command. Can you tell us how to fix the problem?

Answer: You can fix it with a few simple steps.

  1. Open the query.
  2. Choose the Select output type and output form option
  3. Page to the third screen (Define Spooled Output)
  4. Change Spool the output from N to Y

Someone must have accidentally changed this setting. This can be a tough problem to find if you've never seen it before.


 

RPG Character-to-Numeric Conversion

Question: My RPG program is working with data from another system. One of the fields, a 21-byte character field, contains a dollar amount that may include a dollar sign and commas (to separate thousands). I need to extract only the numeric data from the field--not the $ sign, not the comma, not the period, not the "00" at the end--and load the value into a numeric variable. I've tried the %DEC function and the %TRIM function, but no luck. Can you help?

Answer: One of the features of the %DEC function is that it ignores all blanks, embedded ones as well as leading and trailing ones. Therefore, I suggest you use the %XLATE function to convert the dollar signs and commas to blanks.

NumVar = %dec(%xlate('$,':'  ':CharVar):7:0);

There are two spaces in the second parameter of %xlate.


 

Copying Between Data Members and Source Members

Question: I want to copy a source member to a physical file, modify the data, and then copy back to the source member. I know I have seen this discussed in the past. Would you please provide a cursory view on the step to accomplish this task?

Answer: In your COPY FILE (CPYF) commands, specify FMTOPT(*CVTSRC) when copying a data file to a source physical file and vice versa.




                     Post this story to del.icio.us
               Post this story to Digg
    Post this story to Slashdot


Sponsored By
PROFOUND LOGIC SOFTWARE

Need Results Fast?
Web-enable with Genie!

                                                          · Easy Installation
                                                          · Codeless Customizations
                                                          · Instant Results

With Genie on your side, you can be
modernized in less than a day. Simply
install, customize, and deploy.

See the magic of Genie today.

Download a FREE 30-day trial at
www.profoundlogic.com


Senior Technical Editor: Ted Holt
Technical Editors: Howard Arner, Joe Hertvik, Shannon O'Donnell, Kevin Vandever
Contributing Technical Editors: Joel Cochran, Wayne O. Evans, Raymond Everhart,
Bruce Guetzkow, Brian Kelly, Marc Logemann, David Morris
Publisher and Advertising Director: Jenny Thomas
Advertising Sales Representative: Kim Reed
Contact the Editors: To contact anyone on the IT Jungle Team
Go to our contacts page and send us a message.

Sponsored Links

ARCAD Software:  Dynamic, world-class ALM on and around the System i
Tango/04:  Protect your corporate data and enforce your security policies
COMMON:  Join us at the annual 2008 conference, March 30 - April 3, in Nashville, Tennessee


 

IT Jungle Store Top Book Picks

Getting Started with PHP for i5/OS: List Price, $59.95
The System i RPG & RPG IV Tutorial and Lab Exercises: List Price, $59.95
The System i Pocket RPG & RPG IV Guide: List Price, $69.95
The iSeries Pocket Database Guide: List Price, $59.00
The iSeries Pocket Developers' Guide: List Price, $59.00
The iSeries Pocket SQL Guide: List Price, $59.00
The iSeries Pocket Query Guide: List Price, $49.00
The iSeries Pocket WebFacing Primer: List Price, $39.00
Migrating to WebSphere Express for iSeries: List Price, $49.00
iSeries Express Web Implementer's Guide: List Price, $59.00
Getting Started with WebSphere Development Studio for iSeries: List Price, $79.95
Getting Started With WebSphere Development Studio Client for iSeries: List Price, $89.00
Getting Started with WebSphere Express for iSeries: List Price, $49.00
WebFacing Application Design and Development Guide: List Price, $55.00
Can the AS/400 Survive IBM?: List Price, $49.00
The All-Everything Machine: List Price, $29.95
Chip Wars: List Price, $29.95


 
The Four Hundred
A New Year, A New IBM Systems and Technology Group

Rocket Software Buys NetManage for $69 Million

Servers Get Their First Power and Performance Benchmark

Mad Dog 21/21: Motherboarding

IDC 2008: It's Post Disruption, the Aftermath of Webification

The Linux Beacon
Red Hat Taps New CEO As It Reports Solid Third Quarter

Supermicro Preps for Quad-Socket Blade Push

IDC 2008: It's Post Disruption, the Aftermath of Webification

Servers Get Their First Power and Performance Benchmark

A New Year, A New IBM Systems and Technology Group

Four Hundred Stuff
Vision Seeks to Simplify HA Options with 'Hybrid' Solutions

PowerTech i5/OS Security Conference Open to All

CCSS Adds System i Battery Monitoring to QSystem Monitor

Quadrant's Formtastic Keeps Closer Watch on Print Jobs

Help/Systems Buys International Distributor

Big Iron
Sine Nomine Shows Off Solaris on System z

Top Mainframe Stories From Around the Web

Chats, Webinars, Seminars, Shows, and Other Happenings

System i PTF Guide
January 5, 2008: Volume 10, Number 1

December 29, 2007: Volume 9, Number 52

December 22, 2007: Volume 9, Number 51

December 15, 2007: Volume 9, Number 50

December 8, 2007: Volume 9, Number 49

December 1, 2007: Volume 9, Number 48

The Windows Observer
Windows Server 2008 RC1 Debuts with Group Policy Enhancements

Eleven Security Flaws Patched by Microsoft

AMD Stalled by a Bug in Barcelona Opterons

IDC Says Server Buyers Weigh Economy and Power in Q3

The Unix Guardian
Sun Open Sources Sparc T2 Chip, Too

AMD Stalled by a Bug in Barcelona Opterons

IDC Says Server Buyers Weigh Economy and Power in Q3

As I See It: What's Past Is Prologue

Four Hundred Monitor
Four Hundred Monitor's
Full iSeries Events Calendar

THIS ISSUE SPONSORED BY:

Help/Systems
Profound Logic Software
Guild Companies


Printer Friendly Version


TABLE OF CONTENTS
Scrubbing Your Web Data with Elbow Grease and AJAX

Odds and Ends

Admin Alert: Making Educated Guesses on CPU Utilization

Four Hundred Guru

BACK ISSUES

From the IT Jungle Forums
Choose Logical File Format with SQL

IBM 6400 on LPT1 prints junk

Reallocate disk space from one LPAR to another

How to retrieve a workstation ID

Finding *OUTFILE Template Files





 
Subscription Information:
You can unsubscribe, change your email address, or sign up for any of IT Jungle's free e-newsletters through our Web site at http://www.itjungle.com/sub/subscribe.html.

Copyright © 1996-2008 Guild Companies, Inc. All Rights Reserved.
Guild Companies, Inc., 50 Park Terrace East, Suite 8F, New York, NY 10034

Privacy Statement