Summary
Important Observations
- GROUP_BY commands simplify your code and simplify maintenance.
- Check I/O status after performing database operations to ensure necessary conditions are highlighted. IF_STATUS supports, *OKAY, *ERROR, *VALERROR, *NORECORD, *ENDFILE, *BEGINFILE, *EQUALKEY, *NOTEQUALKEY.
- A basic Server Module component can be generated, supporting all I/O operations to the table and its indexes. You can extend this server module.
- Server Modules may be executed by a web page component, synchronously or asynchronously.
- The web page should process after executing a srvroutine asynchronously, in a Completed event handling routine for the srvroutine.
Tips and Techniques
- The CHECK_ONLY parameter on an I/O command allows you to check what would happen if the operation was performed. For example CHECK_ONLY(*yes) on a Delete command checks what would happen if the record was deleted, without actually performing the delete.
- The ISSUE_MSG parameter on the FETCH command displays a message if a record is not found. It is generally better to check using IF_STATUS and issue a more user friendly message.
- Typically, you do not need to open or close tables in LANSA applications. For performance reasons, OPEN and CLOSE commands enable this to be done.
- Special values for the Fields() parameter can be used with database commands such as FETCH, INSERT and UPDATE. For example, the following can be used with the FETCH command:
- *ALL specifies that all fields from the currently active table be fetched.
- *ALL_REAL specifies that all real fields from the currently active table be fetched.
- *ALL_VIRT specifies that all virtual fields from the currently active table be fetched.
- *EXCLUDING specifies that fields following this special value must be excluded from the field list.
- *INCLUDING specifies that fields following this special value must be included in the field list. This special value is only required after an *EXCLUDING entry has caused the field list to be in exclusion mode.
- It is strongly recommended that special values *ALL, *ALL_REAL and *ALL_VIRT are used only when really required. Fetching fields which are not needed causes the application to retrieve and map fields unnecessarily and invalidates cross-reference details (i.e. shows fields that are not used in the component).
What You Should Know
- How to use the FETCH, INSERT, UPDATE and DELETE database commands.
- How to handle errors using the IF_STATUS command when performing database table operations.
- How to use the MessageBox component to provide a confirm dialog.