• The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
Menu
  • The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
  • Odds and Ends

    January 9, 2008 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, .


     

    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

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Tags:

    Sponsored by
    Manta Technologies

    The Leader in IBM i Education!
    Need training on anything i?
    Manta is all you need.

    130 courses and competency exams on:
    · IBM i operations
    · System Management and Security
    · IBM i Programming Tools
    · Programming in RPG, COBOL, CL, Java
    · Web Development

    SQL, DB2, QueryProduct features:
    · Runs in every popular browser
    · Available 24/7/365
    · Free Student Reference Guides
    · Free Student Administration
    · Concurrent User License
    · Built-In IBM i Simulator

    You can download our 200-page catalog and take sample sessions at MantaTech.com

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    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

    New AS2 Certifications on Tap from Drummond The Official 2008 TPM System i Wish List

    Leave a Reply Cancel reply

Volume 8, Number 1 -- January 9, 2008
THIS ISSUE SPONSORED BY:

Help/Systems
Profound Logic Software
Guild Companies

Table of Contents

  • Scrubbing Your Web Data with Elbow Grease and AJAX
  • Odds and Ends
  • Admin Alert: Making Educated Guesses on CPU Utilization

Content archive

  • The Four Hundred
  • Four Hundred Stuff
  • Four Hundred Guru

Recent Posts

  • IBM Unveils Manzan, A New Open Source Event Monitor For IBM i
  • Say Goodbye To Downtime: Update Your Database Without Taking Your Business Offline
  • i-Rays Brings Observability To IBM i Performance Problems
  • Another Non-TR “Technology Refresh” Happens With IBM i TR6
  • IBM i PTF Guide, Volume 27, Number 18
  • Will The Turbulent Economy Downdraft IBM Systems Or Lift It?
  • How IBM Improved The Database With IBM i 7.6
  • Rocket Celebrates 35th Anniversary As Private Equity Owner Ponders Sale
  • 50 Acres And A Humanoid Robot With An AI Avatar
  • IBM i PTF Guide, Volume 27, Number 17

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