IBMi (AS400) fans only ' Extracting Data from DB2 to Excel with ODBC




Configuring ODBC is the first crucial step to enable data transmission between your PC and the IBMi server (AS400).


In my example, I am using the Windows 10 operating system and want to extract data from the public IBMi server PUB400.COM. However, make sure to configure ODBC to point to your specific IBMi environment.


ODBC Configuration on Windows:


1. Open "ODBC Data Sources" in either 32-bit or 64-bit (in my case, 64-bit).

2. Select "iSeries Access ODBC Driver" and click "Add".




**Data Source:** Specify the data source name.



3. Fill in the nine configuration tabs:


- **Server:** Indicate the address of your IBMi server.


   


- **Libraries:** List the libraries containing the files you want to access.

























4. Once the tabs are filled, click "Apply" and "OK".


Extracting Data to Excel:

1. Open Excel.
2. Go to "Data" and then "Get Data".




3. Select "From Other Sources" and choose "From Microsoft Query".





3b. In other Excel version: Select "Legacy Wizard" and choose "From Microsoft Query (legacy)".







4. Select the ODBC data source and click "OK".





5. Choose the file to read (in my case, C00X00F) and click ">".






6. Proceed by clicking "Next" until the process is complete.








7. Click "Finish" and then "OK".


333

The C00X00F file is now imported into Excel.



C00X00F Record Layout:

Here is the structure of the C00X00F record:



C00X00F Record Format (Phisical File Description):

Content of C00X00F on IBMi:

You can view the content of C00X00F using "Display Physical File Member" on IBMi.






Let me know if you encountered any difficulties while implementing ODBC and reading files from DB2.

Every feedback is highly appreciated
!


Comments

Popular posts from this blog

IBMi (AS400) fans only ' Efficient WRKSPLF with WSF - How to Search string into spooled files, Sort, and Generate PDFs on IBMi

IBMi (AS400) fans only - How to Sniff User Access

IBMi (AS400) fans only ' Detecting and Handling Non-Printable Characters in DB2 SQL Using LOCATE() and REPLACE() Functions