Solved

as/400 command help

Posted on 2008-10-13
8
820 Views
Last Modified: 2013-12-06
WHAT COMMAND IS THERE IN AS/400 SIMILAR TO "LIST" COMMAND IN WINDOWS
0
Comment
Question by:sh292
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

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…
In a recent article here at Experts Exchange (http://www.experts-exchange.com/articles/18880/PaperPort-14-in-Windows-10-A-First-Look.html), I discussed my nine-month sandbox testing of the Windows 10 Technical Preview, specifically with respect to r…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

758 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now