Multiple Member Files in SQL

There are two types of aliases that are used most frequently in SQL commands: a column alias and a table alias. There are a variety of reasons that alias may be helpful when querying SQL commands.

- alias in a long query can make your query easier to read and understand
- alias table is use when using a same table in one query
- alias column is to identify the column naming when used together with aggregate functions, then the column is easily understood

In this instance this page describes a table alias. Multiple member files were quite common in IBM midrange computers from the S/36, S38, to the AS/400. SQL was not equipped to deal with these type file objects until OS/400 R430, which added support of an SQL alias statement. Create an alias for each member that must be accessed, then reference the alias from the application. The alias is a persistent object -- it must be created only once. The member referenced in the CREATE ALIAS does not have to exist when the ALIAS is created. Any SQL tool, such as OS/400 or i5/OS interactive SQL (STRSQL) or Operations Navigator, can be used to create the alias, for example:

The application then specifies the alias, MYLIB.FILE1MBR1 or MYLIB.FILE1MBR2, depending on which member it wants to access.