SQL Distinct Type - IBM AS400

This is a discussion on SQL Distinct Type - IBM AS400 ; Hi, In order to simulate field referencing in a CREATE TABLE, I tried the CREATE DISTINCT TYPE command and used the new type as a "reference field" Opening the file in my RPG ILE pgm returns the error CPF428A with ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: SQL Distinct Type

  1. SQL Distinct Type

    Hi,

    In order to simulate field referencing in a CREATE TABLE, I tried the
    CREATE DISTINCT TYPE command and used the new type as a "reference
    field"

    Opening the file in my RPG ILE pgm returns the error CPF428A with the
    reason code 3 (the file has one or more user-defined fields. While the
    OPEN request did not specify this type of field could be processed by
    the requester).

    The result is the same with DFU. Apart from using the file with
    SQLRPGLE programs, is there any way to use the file in a RPG ILE pgm?

    Thx

    Jack


  2. Re: SQL Distinct Type

    Field referencing in SQL is done by creating a model table and
    subsequently doing something like:

    CREATE TABLE NEWTABLE AS (SELECT F1,F2,F7,F9 FROM MODEL TABLE) WITH NO
    DATA

    There are additional options you can use (like RCDFMT etc.). Look up
    CREATE TABLE definition at:

    http://publib.boulder.ibm.com/infoce...zmsthctabl.htm

    Elvis

    Jack wrote:
    > Hi,
    >
    > In order to simulate field referencing in a CREATE TABLE, I tried the
    > CREATE DISTINCT TYPE command and used the new type as a "reference
    > field"
    >
    > Opening the file in my RPG ILE pgm returns the error CPF428A with the
    > reason code 3 (the file has one or more user-defined fields. While the
    > OPEN request did not specify this type of field could be processed by
    > the requester).
    >
    > The result is the same with DFU. Apart from using the file with
    > SQLRPGLE programs, is there any way to use the file in a RPG ILE pgm?
    >
    > Thx
    >
    > Jack



  3. Re: SQL Distinct Type

    For strong typing enforcement, DB2 requires that tables containing UDTs can only
    be accessed with SQL.


    Jack wrote:
    > Hi,
    >
    > In order to simulate field referencing in a CREATE TABLE, I tried the
    > CREATE DISTINCT TYPE command and used the new type as a "reference
    > field"
    >
    > Opening the file in my RPG ILE pgm returns the error CPF428A with the
    > reason code 3 (the file has one or more user-defined fields. While the
    > OPEN request did not specify this type of field could be processed by
    > the requester).
    >
    > The result is the same with DFU. Apart from using the file with
    > SQLRPGLE programs, is there any way to use the file in a RPG ILE pgm?
    >
    > Thx
    >
    > Jack
    >


    --
    Kent Milligan
    ISV Enablement - System i
    kmill@us.eye-bee-m.com (spam trick) GO HAWKEYES!!
    >>> ibm.com/iseries/db2

    (opinions stated are not necessarily those of my employer)

+ Reply to Thread