QSYSObjectPathName class

You can use the QSYSObjectPathName class to represent an object in the integrated file system. Use this class to build an integrated file system name or to parse an integrated file system name into its components.

Several of the IBM® Toolbox for Java™ classes require an integrated file system path name in order to be used. Use a QSYSObjectPathName object to build the name.

Note: Read the Code example disclaimer for important legal information.

The following examples show how to use the QSYSObjectPathName class:

Example 1: The ProgramCall object requires the integrated file system name of the server program to call. A QSYSObjectPathName object is used to build the name. To call program PRINT_IT in library REPORTS using a QSYSObjectPathName:

                       // Create an AS400 object.
     AS400 sys = new AS400("mySystem.myCompany.com");

                       // Create a program call object.
     ProgramCall pgm = new ProgramCall(sys);
 
                       // Create a path name object that
                       // represents program PRINT_IT in
                       // library REPORTS.
     QSYSObjectPathName pgmName = new QSYSObjectPathName("REPORTS",
                                                         "PRINT_IT",
                                                         "PGM");
 
                       // Use the path name object to set
                       // the name on the program call
                       // object.
     pgm.setProgram(pgmName.getPath());
 
                       // ... run the program, process the
                       // results

Example 2: If the name of the AS400 object is used just once, the Java program can use the toPath() method to build the name. This method is more efficient than creating a QSYSObjectPathName object.

                       // Create an AS400 object.
     AS400 sys = new AS400("mySystem.myCompany.com");

                       // Create a program call object.
     ProgramCall pgm = new ProgramCall(sys);
 
                       // Use the toPath method to create
                       // the name that represents program
                       // PRINT_IT in library REPORTS.
     pgm.setProgram(QSYSObjectPathName.toPath("REPORTS",
                                              "PRINT_IT",
                                              "PGM"));
 
                       // ... run the program, process the
                       // results

Example 3: In this example, a Java program was given an integrated file system path. The QSYSObjectPathName class can be used to parse this name into its components:

                       // Create a path name object from
                       // the fully qualified integrated
                       // file system name.
     QSYSObjectPathName ifsName = new QSYSObjectPathName(pathName);
 
                       // Use the path name object to get
                       // the library, name and type of
                       // server object.
     String library = ifsName.getLibraryName();
     String name    = ifsName.getObjectName();
     String type    = ifsName.getObjectType();