Problem solve Get help with specific problems with your technologies, process and projects.

The Lazy Coder: Use your iSeries as a file server

Andrew Borts shows how you can store files on the iSeries as if it were a PC server, allowing you to keep users' files on a centrally located server that's backed up regularly.

You Can View User Feedback To This Tip

Yikes! You've noticed that you have a TON of Integrated File System (IFS) files on your system. What are they doing there?! Well, your iSeries system has been a unified file system for a while. Remember "shared folder" support? That functionality went away as soon as IBM created this hierarchical file system. It looks, tastes and smells like a Windows NT server to any unsuspecting PC linking to it.

What can I do with it?
For SMALL iSeries or AS/400 shops, you can store files on it as if it were a PC server. Store programs, store files -- it doesn't have the same limitations that Shared Folders had. Nor do you need a single morsel of IBM software to access it. This functionality is BUILT into Windows 98 and beyond. My preference is still Windows 2000 or XP Pro for accessing those files. Even better, you can now set up Client Access without even having the CD on you by accessing the directory where the programs are stored. (Look in the QIBM directory!)

Where do I begin? I'm DYING here -- WHEN ARE YOU GOING TO LET ME IN ON THIS SECRET?
To access these files from a green (or Emulation) screen, type WRKLNK or Work Link and press enter. This will display what YOU can access within the IFS. (Note: QSYS (shown as QSYS.LIB) is merely a directory WITHIN the IFS structure.) What can you do from here? Let's create a directory WITHIN the IFS.

On the iSeries system, type MD and prompt using F4. You can now CREATE directories within your IFS. "Hey, wait a second," you say. "That's a DOS command!" You bet -- your 400 understands some DOS.

You can also change directories, so you can create files under a directory. With CD (Change Directory), your "Current" directory is changed so you can perform IFS functions without long prefixes. There's also CD's synonym -- CHGCURDIR (Change Current Directory) -- the iSeries identical twin! (I wonder if there are some people who would NEVER use the command CD but would swear by CHGCURDIR as being more efficient and written for the 64-bit environment.) Do NOT confuse CHGCURDIR with CHGCURLIB -- as that command Changes your Current LIBRARY -- which is really related to the back-end programs.

More Information

Wow! This is too much fun. What ELSE can I do with this thing?
So, do you want to use your 400 as a file server? This exciting bit of software engineering is named iSeries NetServer, and it comes with the following standards in place. The system serial number, with a Q in front of it, is the name of the server. To find this, several steps need to be taken on your PC:

  • Add a line to a file BURIED in Windows 2000 or Windows XP. It is in a subdirectory called /[windows directory]/system32/drivers/etc – where [windows directory] will be where your copy of windows is installed. There you will find two sample files Microsoft gives you: LMHOSTS.SAM and HOSTS.SAM. Inside those is a standard for declaring a sort of local name server for your PC. This helps it find your server and link up with them. Both files use the following format to declare a server.
  • xx.xx.xx.xx SERVERNAME
    Where ;
                xx.xx.xx.xx is the TCP/IP address of the server
                SERVERNAME is the name of the server
    

  • Edit the LMHOSTS.SAM file using Notepad and add your AS/400's information. Example: 192.168.1.1 QS1234567. (Your PC may pop up a window that says, "I don't know WHAT program to open this with. YOU TELL ME!") People using Client Access V5R2 may not need to modify these files as part of the installation manipulates this file, but everyone else on versions below that will need to do so.

    Next, "Save As" and remove the .SAM from the suffix. The file then becomes LMHOSTS.
  • Do the SAME thing with the HOSTS file. Once there, save as "HOSTS." (That's right -- hosts with the period on the end) instead of "HOSTS.SAM". This file is where your computer turns to FIRST to find servers or other computers on your network, THEN the system looks using the declared name servers. These are cool files to understand when troubleshooting Web sites while programming CGI applications -- but that's another tip for another day!
  • If (and I mean IF) your PC's Userid and password are THE SAME as your 400, you'll really have some fun now. Your PC's authentication is now sent to the 400 for its OWN authentication. (I encourage you to keep you and your users in this sort of mindset -- where both servers have the same passwords and userid formats.)
  • If there's ANYTHING you'd like visible to your network of users, you MUST set on a flag that indicates that they are a Shared resource. This is an application located as an extended feature of Operations Navigator. You MUST include the extended functionality when you install Client Access (BIG HINT!).
  • Fire up Operations Navigator and look under "File Systems." You should see "Integrated File System." (If you don't, you need to install that extended functionality I mentioned.) Under "Integrated File System," you'll see "root." Right click on that item. Select "New Share" and declare that you'd like to perform Read/Write operations (unless you'd like the share to ONLY allow READ access to the information on the server). You MUST have proper access to your IFS for these functions, so be sure to buy bagels for the guy who knows the QSECOFR password.
  • If you'd like to MAP the root directory (or whatever SHARE you've declared on your server), you can simply select the "File Shares" portion under the "Integrated File System," then select "root" and right click. You want to then select "Map Network Drive" and declare WHO will be connecting to the system. (You may have to place a password into this setup.)

Now you have this COOL file server, centrally stored by your nightly backups (you DO perform a SAV command each night, right?) which backs up the IFS and can then keep users' documents on a centrally located server.

Confusing? Let's summarize these terms:

  • WRKLNK -- Work with IFS "Links" or Objects
  • MD -- Make Directories (If I want a directory in HOME with my name on it, I'd use "MD /HOME/Andrew" assuming the directory HOME exists.)
  • CD -- Change Current Directory
  • CHGCURDIR -- Change Current Directory
  • iSeries Net.Server -- iSeries IFS agent -- Makes the server look like a Windows NT server.
  • LMHOSTS file -- A file for locating NetBios servers
  • HOSTS file -- A file for locating TCP/IP servers
  • PC -- Used to confuse and befuddle iSeries professionals

-----------------------------------------
About the author: Andrew Borts is webmaster at United Auto Insurance Group in North Miami, Fla. He is often a frequent speaker at COMMON and past president of The Southern National Users Group, an AS/400 user group based in Deerfield, Fla.

USER FEEDBACK TO THIS TIP

  • This tip mentions the usage of mapping a network drive to an IFS folder, which is extremely useful, but can potentially expose the iSeries as a storage location for viruses.

    In order to propagate themselves, viruses tend to search for available drives, and if an iSeries folder is mapped to an infected PC, then the virus can move to the iSeries itself.

    Therefore, a better alternative to mapping is to create a shortcut to the IFS folder instead, and then place the shortcut on the desktop. — Gary Edwards


Dig Deeper on iSeries CL programming

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchDataCenter

Close