Solved

as/400 command help

Posted on 2008-10-13
8
846 Views
Last Modified: 2013-12-06
WHAT COMMAND IS THERE IN AS/400 SIMILAR TO "LIST" COMMAND IN WINDOWS
0
Comment
Question by:sh292
[X]
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
8 Comments
 
LVL 5

Accepted Solution

by:
JBart_17 earned 43 total points
ID: 22703180
WRKOBJ OBJ(*ALL/*ALL)
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.
0
 
LVL 27

Assisted Solution

by:tliotta
tliotta earned 41 total points
ID: 22706579
sh292:

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?

Tom
0
 

Author Comment

by:sh292
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
0
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

by:tliotta
ID: 22714964
sh292:

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"?

Tom
0
 
LVL 2

Expert Comment

by:redhed72
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
0
 
LVL 1

Expert Comment

by:nigel_pettit
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.

Nigel
0
 
LVL 1

Assisted Solution

by:xaviercsc
xaviercsc earned 41 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("mySystem.myCompany.com");

                       // 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(subDirNames[i]);
     else
       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("mySystem.myCompany.com");

                       // 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(names[i]);
     else
       System.out.println("No .txt files");

0

Featured Post

WordPress Tutorial 4: Recommended Plugins

Now that you have WordPress installed, understand the interface, and know how to install new parts, let’s take a look at our recommended plugins.

Question has a verified solution.

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

Introduction How to create multiboot configuration with XP\Vista and Windows 7 on it? And most important question - how to do this correctly so not to have any kind of nightmares we get when system gets screwed? First of all one should realize t…
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.
Suggested Courses

617 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