Ask the Expert

Converting alpha fields

We have a file that contains an alpha customer number (required because of EDI standards). The customer number in our application software is 9,0. Is there a way to create a logical view over either the EDI file, or our application files, that will convert the alpha field to a numeric field in the logical?
You can create a logical file that just maps the field to a number field data type. If COL1 was the alpha customer number field in the physical file, the Logical file DDS would just define a new data type for COL1.

COL1 9S 0

SQL Views can also be used. SQL Views are equivalent to non-keyed logical file and actually can be opened as a non-keyed logical file by HLL applications. SQL Views offer superior functions and expression capabilities that logical files. The following SQL View could be created directly over the EDI file. This example assumes that the EDI file is stored as one large character column in an iSeries file & that the customer number is the first nine bytes of the EDI data record. create view v1 (custnum) as (select decimal(substr(c1,1,9),9,0) from edifile)

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

Search400.com's targeted search engine: Get relevant information on DB2/400.

The Best Web Links: tips, tutorials and more.

Check out this online event, Getting the Most out of SQL & DB2 UDB for the iSeries.


This was first published in June 2003

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: