7.75.2 POINT Comments/Warnings
- When an RDML program is first invoked (or subsequently invoked in LIGHT usage mode) the internal details of all files, libraries and members to be used are initialized as if the command is executed for every file used by the program.
POINT FILE(XXXXX) TO_FILE(XXXXX) TO_LIBRARY(*LIBL)
TO_MEMBER(*FIRST)
This means that by default files are opened with the same name as they were coded, using the library list to locate the file and accessing the first member in the file.
- The POINT command is an executable command. The internal details of which file, library and member are to be used are updated when the POINT command executes.
- Interactive RDML functions attempt to overlap database file opens with the first screen interaction. So it is advisable to execute all required POINT commands before issuing the first DISPLAY, REQUEST or POP_UP command.
- File re-direction details provided in a POINT command apply only to the current function, not to called or subsequently invoked functions. They must specify their own POINT commands.
- When a POINT command is issued against a logical file you must also specify a POINT command for the associated/underlying physical file. This is because many I/O requests made via the logical file are actually performed via the physical file (e.g.: UPDATE, DELETE, LOCK(*YES)). This requirement is checked by the full function checker which will issue a fatal error if it is not complied with.
- For similar reasons, when a POINT command is issued against a physical file, POINT commands must also be issued for any associated logical files that are used by the function. This requirement is checked by the full function checker which will issue a fatal error message if it is not complied with.
- It is possible using POINT commands that a physical file is re-directed to a particular member and an associated logical view is re-directed to another member. In this situation strange and unpredictable results may occur. For instance a record read from member A via a logical view and then updated, may actually update a completely different record in member B.
- Take care when using the POINT command. Make sure that the logical and physical file POINT commands involved ultimately "point" to data in the same physical file member.
- When the actual file, library or member being accessed is to be changed while a function is executing the file must be closed via a CLOSE command or the I/O module will issue a fatal error.
For instance, this command will fail on the second FETCH:
POINT FILE(CUSTMST) TO_MEMBER(CURRENT)
FETCH FIELDS(#NAME) FROM_FILE(CUSTMST) WITH_KEY(#CUSTNO)
POINT FILE(CUSTMST) TO_MEMBER(ARCHIVE)
FETCH FIELDS(#NAME) FROM_FILE(CUSTMST) WITH_KEY(#CUSTNO)
The I/O module will abort with an error indicating that member CURRENT is open and you have asked for an I/O to member ARCHIVE.
The correct way to achieve this is as follows:
POINT FILE(CUSTMST) TO_MEMBER(CURRENT)
FETCH FIELDS(#NAME) FROM_FILE(CUSTMST) WITH_KEY(#CUSTNO)
CLOSE FILE(CUSTMST)
POINT FILE(CUSTMST) TO_MEMBER(ARCHIVE)
FETCH FIELDS(#NAME) FROM_FILE(CUSTMST) WITH_KEY(#CUSTNO)
- Where entire application systems use multi-member files there is usually a predictable naming convention used for file members. For example, in multi-company financial systems the member name may be an "M" followed by the company number. In such cases it is worth creating system variables that automatically set the name of the member to be used.
Consider the following examples of standard coding at the beginning of all RDML programs used in a multi-member financial system:
POINT FILE(GLMAST) TO_MEMBER(*COMPANY_MBR)
POINT FILE(SUMAST) TO_MEMBER(*COMPANY_MBR)
POINT FILE(FTMAST) TO_MEMBER(*COMPANY_MBR)
The same feature can be used to determine the name of the library that is to be used. For instance a system that utilizes 3 identical data libraries called PRODUCTION, TESTING1 and TESTING2 might use the following coding at the beginning of all RDML programs:
POINT FILE(GLMAST) TO_LIBRARY(*DATA_LIBRARY)
POINT FILE(SUMAST) TO_LIBRARY(*DATA_LIBRARY)
POINT FILE(FTMAST) TO_LIBRARY(*DATA_LIBRARY)
The program behind the system variable "*DATA_LIBRARY" works out the required library name from the user profile or some other identifier.
- In the current release of LANSA, files used by I/O modules for other purposes such as data validation and batch control logic cannot be re-directed. They are always opened by searching the library list and using the first member in the file.
- Where I/O is re-directed to a file that has not been defined to LANSA it is not possible for LANSA to check the user's access rights against its internal security information. In such cases the user is granted "special access" and a warning message is issued. Such access is still subject to normal IBM i operating system security.
- It is the developer's responsibility to check and test the ramifications of using the POINT command in any RDML program.