Posts

Showing posts from December, 2022

IBMi (AS400) fans only ' How to access multimember physical file using SQL alias

Image
#IBMiSample Each IBMi user knows they run the most efficient system. All others just have too much money. SQL does not have direct access to multiple-member physical files on IBM i. However, OS/400 provides a solution through the SQL `ALIAS` statement. By creating an alias for the specific member you want to access, you can work with that member using SQL. Example Using the IBM i PUB400 Public Server Let's walk through an example using the IBM i PUB400 public server. In this scenario, we have a physical file `QDDSLF` located in the library `VDOTEST1`, which contains multiple members: In library VDOTEST1, file QDDSLF I have 8 members. CLANA01L CLANA02L CLANA03L CLANA04L CLANA05L CLANA06L CNCON01L OTORD01L Suppose you want to access the member `CLANA03L` using SQL. To do this, follow these steps: 1. Create an Alias for the Member:         Open an SQL session using `STRSQL` and create an alias for the specific member:    CREATE ALIAS A_CLANA03L FOR VDOTEST1.QDDSLF(CLANA03L);      This