Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


as/400 command help

Posted on 2008-10-13
Medium Priority
Last Modified: 2013-12-06
Question by:sh292
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

JBart_17 earned 172 total points
ID: 22703180
but you really should but in a library name or a Object type or you will get way more results than you know what to do with.
LVL 27

Assisted Solution

tliotta earned 164 total points
ID: 22706579

When I enter LIST on a Windows 2000 command line, I get a "'list' is not recognized as an internal or external command, operable program or batch file." error. A quick look at a list of Win XP commands doesn't show "LIST" as a valid command.

So, I assume you have something specific in mind.

The WRKOBJ command is useful for listing objects in the native database file system, as noted above. The WRKLNK command is useful for listing directories and streamfiles from a standard command line.

If you're working in one of the various Unix-like shells, the standard ls utility works pretty much like it does anywhere else.

Can you clarify what you need?


Author Comment

ID: 22710128
Actually i have to list the files in as/400 directory from my java code ...fow windows we use List command to list the files in a given directory ..wht can i use in as/400
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 27

Expert Comment

ID: 22714964

It's now less clear... your java for listing contents of a directory should run the same on an AS/400 as it does under Windows. However, the "List command" isn't familiar to me.

Can you supply a snippet of java that demonstrates using "LIST"?


Expert Comment

ID: 22715979
To see the contents of a directory in the IFS of the 400 use the command WRKLNK.  Specifically, you'll need to state the path to the directory you want to view the contents of.  For example, I have a series of sub-directories and I want to see the contents of the files in one of these.  To do this, I use the command:

WRKLNK '/insite/Outbound/999983/*'

Note the tic marks (single apostrophes) around the directory path.  Also note the /* at the end of the last directory name.  That's important or else you'll just get the last directory and have to select an option to view the contents.

Hope this helps!

Carol York

Expert Comment

ID: 24123716
For iseries oblects ther are many ways of doing this.  Try wrklib then option 12 i think.
The best option I filnd for looking at objects is to do a dspobjd to an outfile then querying the outfile for specifics.


Assisted Solution

xaviercsc earned 164 total points
ID: 26147293
The IFSFile class represents an object in the AS/400 integrated file system. You can use IFSFileInputStream, IFSFileOutputStream, and IFSRandomAccessFile to read and write to the file.

The below example shows how to list files on the AS/400. A filter object is supplied so that only directories are listed.

                       // Create the AS400 object.
     AS400 system = new AS400("");

                       // Create the file object.
     IFSFile directory = new IFSFile(system, "/");

                       // Generate a list of all
                       // subdirectories in the directory.
                       // It uses the filter defined below.
     String[] DirNames = directory.list(new DirectoryFilter());

                       // Display the results.
     if (subDirNames != null)
       for (int i = 0; i < subDirNames.length; i++)
       System.out.println("No subdirectories.");

                       // Here is the filter. It keeps
                       // directories and discards files.
                       // The accept method is called for
                       // every directory entry in the list.
                       // If the element is a directory,
                       // 'true' is returned so the
                       // directory is returned. The results
                       // are returned in the string array
                       // returned to the list() method
                       // above.
     class DirectoryFilter implements IFSFileFilter
        public boolean accept(IFSFile file)
          return file.isDirectory();

The Java program can optionally specify match criteria when listing files in the directory. Match criteria reduce the number of files that are returned by AS/400 to the IFSFile object, which improves performance. The following example shows how to list files with extension .txt:

                       // Create the AS400 object.
     AS400 system = new AS400("");

                       // Create the file object.
     IFSFile directory = new IFSFile(system, "/");

                       // Generate a list of all files with
                       // extension .txt
     String[] names = directory.list("*.txt");

                       // Display the names.
     if (names != null)
       for (int i = 0; i < names.length; i++)
       System.out.println("No .txt files");


Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many people tend to confuse the function of a virus with the one of adware, this misunderstanding of the basic of what each software is and how it operates causes users and organizations to take the wrong security measures that would protect them ag…
Sometimes a user will call me frantically, explaining that something has gone wrong and they have tried everything (read - they have messed it up more and now need someone to clean up) and it still does no good, can I help them?!  Usually the standa…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question