System/38-Compatible Database Tools

This section describes the System/38-compatible data file utility (DFU/38) and the System/38-compatible query utility (Query/38).

System/38-Compatible Data File Utility (DFU/38)

DFU/38 data entry applications can be created and used with DDM to work with remote files in the same manner as with local files. If a remote file is on an AS/400 system or System/38, most DFU/38 functions are performed with the remote file as though it is a local file. When creating or changing a DFU/38 application and the remote file is a logical file, the following consideration applies: either DDM files referring to each remote based-on file must exist on the source system, and the DDM file and library names must match those of the remote based-on files; or, alternatively, physical files with the same file and library names and the same record formats as the remote based-on files must exist on the source system. Because only the record formats are needed from the physical files, they need not contain data. Using this alternative, if the record formats of the remote based-on files are changed, the record formats on the source system must also be changed so that the record formats match.

However, DFU/38 does not support non-AS/400 or non-System/38 target systems. If you attempt to use DFU/38 with non-AS/400 or non-System/38 remote files, you may experience processing problems when trying to change or delete records in such a file. Although an AS/400 system does not prevent any user from creating and using such an application, the default field descriptions created on the source AS/400 system for the non-AS/400 or non-System/38 remote file would probably be too general to be useful. (These files appear to be physical files with one member, whose member name is the same as the file name. The file has one record format and within that format: one field for the entire record, if it is a nonkeyed file; two fields for keyed files, one for the key and one for the remainder of the record; or more than two fields for keyed files with separate key fields.)

All the DFU/38 commands can be used in applications that access local files or DDM files. And, wherever a local database file name can be specified on any of the DFU command parameters, a DDM file can also be specified, as long as any other limitations are met.

A DDM file name can be specified in the SRCFILE parameter of the Create DFU Application (CRTDFUAPP) or Retrieve DFU Source (RTVDFUSRC) command, but only if the target system is an AS/400 system or a System/38 and if the target file is a source physical file.

System/38-Compatible Query Utility (Query/38)

The System/38-compatible query utility (Query/38) can be used with DDM to create and use interactive or batch query applications. (DDM considerations with interactive database query are described in OS/400 Database Query.) If the target system is an AS/400 system or a System/38, most of these functions can be performed as though the remote file is a local file. When creating or changing a Query/38 application and the remote file is a logical file, the following consideration applies: either DDM files referring to each remote based-on file must exist on the source system, and the DDM file and library names must match those of the remote based-on files; or, alternatively, physical files with the same file and library names and the same record formats as the remote based-on files must exist on the source system. Because only the record formats are needed from the physical files, they need not contain data. Using this alternative, if the record formats of the remote based-on files are changed, the record formats on the source system must also be changed so that the record formats match.

If the target system is not an AS/400 system or a System/38, you should refer to a local file for the format and fields that describe the data in the remote file, and then use the Override Database File (OVRDBF) command to override the local file with a DDM file when the Query/38 application is run. This is explained further in Non-AS/400. or Non-System/38 Query/38 Example. The local file used to create (or re-create) the query must have the same record format name as the source description of the non-AS/400 or non-System/38 target file. The default record format name is the name of the source DDM file.

Although Query/38 can create an application that uses a file on a non-AS/400 or non-System/38 system, the default field descriptions created on the source AS/400 system for the non-AS/400 remote file probably would be too general to be useful. (These files appear to be physical files with one member, whose member name is the same as the file name. The file has one record format and within that format: one field for the entire record, if it is a nonkeyed file; two fields for keyed files, one for the key and one for the remainder of the record; or more than two fields for keyed files with separate key fields.)

Non-AS/400. or Non-System/38 Query/38 Example

The following is an example of how to create a local file and use it to define the data that is to be queried in a non-AS/400 or non-System/38 remote file.

Assume that a DDM file named RMTS36FILE exists on your AS/400 system and it refers to a remote System/36 file that you want to query. You can perform the following steps to: determine the attributes of the remote System/36 file; locally create a physical file that has the attributes of the remote file; and define, create, and run the Query/38 against the remote file.

  1. Use the Display File Field Description (DSPFFD) command and specify SYSTEM(*RMT) to display the attributes of the remote file associated with the RMTS36FILE DDM file.
    DSPFFD  FILE(RMTS36FILE) SYSTEM(*RMT)
    

    In this example, the displayed results would show that the remote file's record length is 80 characters, its record format name is RMTS36FILE, and it has two fields: K00001, with 12 characters (starting in position 1), and F00001, with 68 characters (starting in position 13). The K in field K00001 indicates it is the key field for this format.

  2. Using the DDS and the above information before defining your Query/38 application, create a local physical file and call it LCLS36FILE. The DDS might look something like this:
          A          R RMTS36FILE
          A            CUSNO           6A
          A            BILLCODE        6A
          A            ADDR1          15A
          A            ADDR2          15A
          A            ADDR3          15A
          A            ZIP             5A
          A            AMTOWE          7S 2
          A            OUTBAL          7S 2
          A            MISC            4A
          A          K CUSNO
          A          K BILLCODE
    

    Three main rules must be followed when defining the local file:

  3. Define your Query/38 application using the local file created in step 2. Because the remote file is a non-AS/400 file, OPTIMIZE(*NO) should be specified on the query command. (See Query/38 Optimization for DDM for more information.)
  4. Before your Query/38 application is run, issue the following Override Database File (OVRDBF) command:
    OVRDBF  FILE(LCLS36FILE) TOFILE(RMTS36FILE)
    

    When the Query/38 application is run, this command overrides the local file you created with the DDM file that is associated with the desired target file.

  5. Run your Query/38 application using the Query Data (QRYDTA) command. The net effect is that a query of the remote file is done using the local file description.

Query/38 Output Considerations for DDM

Query/38 output to an existing non-AS/400 or a non-System/38 target file is possible, but only under specific circumstances. Query/38 allows output to any local or remote file only if the file is sequential and if its field attributes match those attributes required by the Query/38 application. If both conditions are not met, Query/38 rejects the specified output file before the Query/38 application runs.

Because the source system description of a non-AS/400 or a non-System/38 target file is very general, its field attributes probably do not match the attributes required by the Query/38 application. Therefore, in most cases, Query/38 rejects that file if it is specified for output. It works, however, if the Query/38 output consists of one alphanumeric field only, and if the record length of the target file is large enough to hold this field.

Query/38 Command Considerations for DDM

All the Query/38 commands can be used in applications that access local files or DDM files. And, wherever a local database file name can be specified on any of the Query/38 command parameters, a DDM file can also be specified, as long as any other limitations are met.
Note:If a Query/38 command uses a DDM file associated with a remote file on a non-AS/400 or a non-System/38 target system, either the DDM file should specify LVLCHK(*NO) or an OVRDBF command should be used to override that parameter with *NO. This is recommended to avoid level-checking problems with the target file.

A DDM file name can be specified in the SRCFILE parameter of the Create Query Application (CRTQRYAPP) or Retrieve Query Source (RTVQRYSRC) command, but only if the target system is an AS/400 system or a System/38 and if the target file is a source physical file.

Query/38 Optimization for DDM

Query/38 has an optimization function, but because it causes OS/400 database query to be used, the feature cannot be used when the query is performed against a remote file that is not on an AS/400 system or a System/38. Because OS/400 database query does not exist on non-AS/400 systems or non-System/38s, the optimization function cannot be used by the source AS/400 system when performing a query against a non-AS/400 or a non-System/38 remote file. (See OS/400 Database Query.)

Therefore, when a Query/38 application is being created or changed that accesses a remote file on a non-AS/400 system or a non-System/38, the OPTIMIZE parameter on the Create Query Application (CRTQRYAPP), Create Query Definition (CRTQRYDEF), or Change Query Definition (CHGQRYDEF) command must be changed to *NO. Specifying OPTIMIZE(*NO) forces Query/38 to read the file sequentially, which can be done with non-AS/400 target files. If the default of *YES is used, an error occurs when the Query/38 application is run.

Similarly, if the Design Query Application (DSNQRYAPP) command is used to create and run queries that are to be performed on a non-AS/400 target file, the Optimize Query prompt on the Application Creation display must be changed from Y to N.

Existing Query/38 Application Considerations for DDM

Existing Query/38 applications, if they are to query remote files, must be re-created in all cases, even if the target system is an AS/400 system or a System/38. If the target system is an AS/400 system or a System/38, the re-created application that uses a DDM file is defined and run as if the remote file is a local file. The optimization feature can be used to get the records from the target AS/400 system or the target System/38.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]