Accessing remote files from LANSA using DDM

Date:Archived
Product/Release:LANSA for the AS/400
Abstract:Accessing remote files from LANSA using the OS/400 Distributed Data Management (DDM) facility
Submitted By:LANSA Technical Support

How remote files can be accessed from LANSA.

To use the DDM facility, the local (source) AS/400 and the remote (target) AS/400 have to be nodes of the same network. Usually, the system node name is the same as the one that appears on the upper right corner of the sign-on screen (please, use DSPNETA and refer to the local control point name to confirm this).

A DDM file, although considered a physical file, does not have any data. It is a sort of gateway to the remote file. If LANSA (or any other program) opens and reads data from the DDM file, it is actually reading the data from the remote location where the real file exists.

To access a remote file using DDM, perform the following steps:

  1. Create the DDM file on the local AS/400
    To create a DDM file you must issue the command:

    CRTDDMF FILE(MYLIB/DDMFILE) RMTFILE(RMTLIB/RMTFILE0 RMTLOCNAME(RMTAS400)

    To verify access to the remote file, issue the command:

    DSPPFM MYLIB/DDMFILE

    The data of RMTFILE should be displayed in the RMTLIB library on the remote AS/400.
     
  2. Create the file on the local AS/400 with the definitions from the remote one
    • 2.1 On the local AS/400, create a physical file with the same name as the DDM file (e.g. DDMFILE), but the same format and fields as the remote file (e.g. RMTFILE). Use the same file name, if desired.
    • 2.1.1 If the remote file is not maintained by LANSA, it will not have the @@UPID field which is automatically created by LANSA. It will be necessary to define the file externally (i.e. using DDS specs) and then load it into LANSA as maintained by OTHER (check that this is not a DDM file, it is simply a file created to define its definitions in LANSA, but it will not be used).
    • 2.1.2 If the remote file is maintained by LANSA, create the file from LANSA.
    • 2.2 Make the file operational.
    • 2.2.1 If the file is not maintained by LANSA, LANSA will be pointing to the physical file in the library where it was created (e.g. CRTPF, via DDS definitions).
    • 2.2.2 If the file is maintained by LANSA, a physical file will be created. In any case the I/O Module will be pointing to a local file.

      Note: Do not try to load the DDM file into LANSA at this stage. It will not work.
       
  3. Make LANSA point to the DDM file
    • 3.1 If the file is not maintained by LANSA (i.e. is pointing to an external library) rename, move (i.e. MOVOBJ) or delete it (if it is not needed) from that library and move the DDM file (which must have the same name as the external file), into the external library. In other words, the local physical file name is being replaced with the DDM file (i.e. via CPYF or MOVOBJ).
    • 3.2 If the file is maintained by LANSA, there are two options:
      • Follow the same procedure as 3.1 (i.e. moving the file into the LANSA partition file library); or,
      • Include the library, where the DDM file resides, in the library list of the job description of the user profile being used. This library must be in a higher position than the LANSA files libraries. In this way LANSA will then pick up the DDM file without the need to delete the file in the LANSA file library.

      Alternative approaches are to use the POINT RDML command (i.e. after using the *ONDEMAND on the OPEN command to open the file) or; use the permanent file override option (especially for client/server applications -i.e. using LANSA Client, LANSA/Server or Superserver).

Please contact LANSA Technical Support if more details on this issue are needed.