Problem solve Get help with specific problems with your technologies, process and projects.

Converting logical files to views

This tip will be useful to those that are converting DB2/400 files to Oracle.

Here's a way to convert DB2/400 logical files to views automatically. Programmer's can write a small utility to convert all DB2/400 logical to views.


For example: You have a physical file (ORACLE, is the name of the file).

R ORACLER
ACCOUNT 4S 0
TYPE 1A
DESC 30A

And the Logical Over the above file is ORACLE1

R ORACLER PFILE(ORACLE)
K ACCOUNT
S TYPE COMP(EQ 'A')

Need to do the following steps:

Use the following command to get the file information:

DSPFD FILE(*LIBL/ORACLE1) TYPE(*SELECT) OUTPUT(*OUTFILE) OUTFILE(*LIBL/ORACLEOF)

Once you have executed the above command, ORACLEOF will be created.

Use the following fields to get the Select/Omit information from ORACLEOF:

SOFLD (To get the Select/Omit fields)
SORULE (To get Select/Omit Flag)
SOCOMP (Comparison flag like EQ, GT, GE etc.,)
SOVALU (To get the comparison values etc.)

With the above information, you can able to build the SQL Statements (Views)

==================================
MORE INFORMATION ON THIS TOPIC
==================================

The Best Web Links: tips, tutorials and more.

Ask your programming questions--or help out your peers by answering them--in our live discussion forums.

Ask the Experts yourself: Our application development gurus are waiting to answer your programming questions.

Dig Deeper on iSeries CL programming

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchDataCenter

Close