Home > AS/400 Tips > iSeries administrator tips > Tricks and techniques for FTP-ing OS/400 save files
iSeries 400 Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

ISERIES ADMINISTRATOR TIPS

Tricks and techniques for FTP-ing OS/400 save files


Joe Hertvik
01.23.2002
Rating: -4.27- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


Save files (SAVF) are great for transferring iSeries and AS/400 objects between OS/400-based machines. Whether it's a group PTF, a file, a library or even a licensed program, save files can quickly zip large amounts of information between two AS/400s, especially if the save files are transmitted via FTP.

Unfortunately, there's a little bit of misunderstanding about how to properly FTP save files between two AS/400s. There are a few simple, but hard-fast, rules that users must follow to successfully transfer save files. To that end, here's my formula for FTPing save files between iSeries and AS/400 machines.

  1. Binary is best. -- For speed and accuracy, always choose Binary mode (TYPE I, or Image) FTP transfers between your AS/400s. Binary mode is specified by using the BIN FTP subcommand in your FTP session, as follows:

    BIN

    For more recent OS/400 versions, FTP may force you to use binary mode before it will transfer a save file.

    Binary mode is called an Image transfer for good reason. Binary transfers mean that OS/400 FTP will create an exact mirror image of your save file on your target machine. The file is transferred bit-by-bit, and it is reassembled on the receiving machine exactly as it looks on the sending machine, with no EBCDIC translation performed. Incidentally, this also helps speed up your FTP transfer.

  2. FTP sometimes creates your target save files correctly. -- This is where most people trying to FTP save files get tripped up: through mistakes caused by not understanding how FTP automatically creates save files on the target machine. There are two ways to insure that your save file is correctly created on your target machine, and the method you choose is dependent on how you specify the NAMEFMT parameter in your FTP session.

    If you use NAMEFMT 0 in your FTP transfer -- where OS/400 libraries and objects are defined in a library/filename format -- the save file must already be present on your target system before the transfer begins, and it must also be identified to OS/400 as a save file. If the target save file isn't present, OS/400 will not transfer the file correctly and it will probably create a physical file, not a save file, to hold the results of your transfer. For NAMEFMT 0 transfers, you can use the Create Save File (Create Save File) command as follows to create the receiving save file on your target machine before the FTP session begins:

    Alternatively, an FTP client session can also create a save file on the target machine by using the FTP Remote Command sub-command (RCMD), which executes an OS/400 command on a remote machine. Here's an example of how you could create the same save file on a remote FTP host by using the RCMD command inside your session:

    If you have the proper authority, any command that follows the 'QUOTE RCMD' string will be executed on the host AS/400 as if it were typed in on a command line. This is handy for ...


    Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



    RELATED CONTENT
    iSeries administrator tips
    Translating Linux for IBM i admins: Using GUI to make it easy
    Translating Linux for IBM i admins: Working with jobs and networking
    OpenOffice: What to know before making the transition from Microsoft Office
    OpenOffice: An enterprise open source solution
    Database performance comparisons on IBM i
    Translating Linux for IBM i admins: User profile commands
    Modern System i reports using Client Access
    Tips for installing Lotus Domino server on a System i partition
    The iSeries Blog has a new home on IT Knowledge Exchange
    Virtualization for IBM i: Backups

    Systems Management
    Can you trust all those trigger programs?
    Are your backups complete?
    Controlling remote command processing
    Watch your profiles
    Avoid locking issues
    Send message to users at a remote site
    Security journal receiver management
    Top 10 backup commands
    Tracking critical file access in real time
    Create an iSeries Access image and update it with the latest Service Pack

    iSeries Networking
    CA Express utility helps you manage SSL certificates
    20 FTP tips in 20 minutes
    The Lazy Coder: Find your iSeries using a DNS or name server
    The Lazy Coder: Fun with TCP/IP
    Automatically check FTP process for errors
    Fast guide to Redbooks and guides on printing/output
    Printing tips and tricks
    Improve old iSeries communication methods
    'Twas the Night Before Christmas in IT
    How to FTP a physical file via iSeries modem

    RELATED RESOURCES
    2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
    Search Bitpipe.com for the latest white papers and business webcasts
    Whatis.com, the online computer dictionary


    executing almost any OS/400 command from inside an FTP session.

    For FTP sessions that are run under NAMEFMT 1 -- where OS/400 file names are defined in the Integrated File System (IFS) format -- FTP will automatically create your save file correctly on the target machine when you fulfill two conditions: 1. You must use the IFS naming convention for your save file on your GET, MGET, PUT or MPUT sub-commands. 2. You must specify a .SAVF extension for the file being transferred. Here's what a simple PUT command would look like when transferring a save file in a NAMEFMT 1 FTP session:

    Because you specified the file as a save file (.SAVF), FTP will properly create the save file on your target machine -- if it's not already present -- using the target name specified in your PUT statement. Using PUT (or MPUT) in a NAMEFMT 1 session this way bypasses the need to create a new save file on your target system before the save is started.

  3. An empty target save file is a beautiful thing. -- For transferring save files, an existing target save file must also be empty for the transfer to succeed. That means the file must either be newly created (through the CRTSAVF command or PUT technique as shown above) or you must clear the target save file before starting the transfer. You clear the target file by using the Clear Save File (CLRSAVF) command before the transfer begins, as follows:

    Or you can execute this command inside your FTP session by, again, using the FTP RCMD sub-command:

    Either of those techniques will allow the target save file to be cleared, which will make for a successful transfer.

Given these rules, here's two FTP scripts that show how you would transfer the same save file from one AS/400 to another using either the NAMEFMT 0 or NAMEFMT 1 file naming conventions.

For a NAMEFMT 0 FTP transfer, a typical FTP save file transfer might use these commands:

In this case, you may decide not to use both the CRTSAVF and CLRSAVF commands together, but I put them in this session sample for illustration.

For a NAMEFMT 1 FTP transfer, a typical FTP save file transfer might use these commands:

You could also execute the CLRSAVF command through QUOTE RCMD if the save file already exists on your target and it needs to be cleared before the transfer. Using a NAMEFMT 1 transfer makes it easier to create save files on your target system, but you have to code your GET, MGET, PUT and MPUT commands to proper specify file names in the IFS naming convention.

As you can see, transferring save files between AS/400s isn't that bad once you understand the rules. If you play around with the simple rules and techniques I discussed here, you'll be successfully FTPing save files between your AS/400 machines in no time.

-------------------------
About the author: Joe Hertvik is an IT professional and freelance writer who has been working with OS/400 since the days of the System/38 in the mid-1980s. Joe can be reached at jhertvik@midrangeserver.com.

========================
MORE INFORMATION
========================


Rate this Tip
To rate tips, you must be a member of Search400.com.
Register now to start rating these tips. Log in if you are already a member.


Submit a Tip




DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



iSeries Security - Security Tools, Physical Security and System Security
HomeNewsTopicsITKnowledge ExchangeTipsBlogsAsk the ExpertsMultimediaWhite PapersProducts
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 1999 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts