Unix Technical Forum

AS/400: generate unique numbers

This is a discussion on AS/400: generate unique numbers within the DB2 forums, part of the Database Server Software category; --> It seems that on AS/400, the IDENTITY option is not available. For example, I cannot declare a column as ...


Go Back   Unix Technical Forum > Database Server Software > DB2

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-27-2008, 04:36 AM
deebeetwo@yahoo.com
 
Posts: n/a
Default AS/400: generate unique numbers

It seems that on AS/400, the IDENTITY option is not available. For
example, I cannot declare a column as "integer generated always as
identity".

Is there an alternative that I can use? The numbers that I would like
generated do not need to be sequential.

Thanks in advance!

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-27-2008, 04:36 AM
4.spam@mail.ru
 
Posts: n/a
Default Re: AS/400: generate unique numbers

Hello.

You can do it since V5R2.
What version do you use?
If your as/400 version is older write c (or java, or etc...) udf
generating unique value and use it in before trigger.

Sincerely,
Mark B.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-27-2008, 04:36 AM
Anton Versteeg
 
Posts: n/a
Default Re: AS/400: generate unique numbers

deebeetwo@yahoo.com wrote:

> It seems that on AS/400, the IDENTITY option is not available. For
> example, I cannot declare a column as "integer generated always as
> identity".
>
> Is there an alternative that I can use? The numbers that I would like
> generated do not need to be sequential.
>
> Thanks in advance!
>

What version are you on?
If I am correct identity values are supported since V5R3

--
Anton Versteeg
IBM Netherlands
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-27-2008, 04:36 AM
Anton Versteeg
 
Posts: n/a
Default Re: AS/400: generate unique numbers

Anton Versteeg wrote:

> deebeetwo@yahoo.com wrote:
>
>> It seems that on AS/400, the IDENTITY option is not available. For
>> example, I cannot declare a column as "integer generated always as
>> identity".
>>
>> Is there an alternative that I can use? The numbers that I would like
>> generated do not need to be sequential.
>>
>> Thanks in advance!
>>

> What version are you on?
> If I am correct identity values are supported since V5R3
>

Correction: Since V5R2

--
Anton Versteeg
IBM Netherlands
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-27-2008, 04:36 AM
Serge Rielau
 
Posts: n/a
Default Re: AS/400: generate unique numbers

deebeetwo@yahoo.com wrote:
> It seems that on AS/400, the IDENTITY option is not available. For
> example, I cannot declare a column as "integer generated always as
> identity".
>
> Is there an alternative that I can use? The numbers that I would like
> generated do not need to be sequential.

DB2 for iSeries does support IDENTITY. Maybe you are on a backlevel version?

Cheers
Serge

--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 02-27-2008, 04:36 AM
deebeetwo@yahoo.com
 
Posts: n/a
Default Re: AS/400: generate unique numbers

4.spam@mail.ru wrote:
> Hello.
>
> You can do it since V5R2.
> What version do you use?
> If your as/400 version is older write c (or java, or etc...) udf
> generating unique value and use it in before trigger.


Interestingly enough, it is Version 5 Release 1! I will see what it
takes to write a udf and use it in statements.

Thanks a lot!

>
> Sincerely,
> Mark B.


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 02-27-2008, 04:36 AM
deebeetwo@yahoo.com
 
Posts: n/a
Default Re: AS/400: generate unique numbers

Serge Rielau wrote:
> DB2 for iSeries does support IDENTITY. Maybe you are on a backlevel version?


You are absolutely right. I talked to the admin guy and the version is
indeed V5R1. (By the way, is there a way to find this out from the
system itself directly?)

As another poster suggested, an option is to use a UDF written in
C/Java. In that case, could I use the call to that function in an
Insert or Select statements?



> Cheers
> Serge


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 02-27-2008, 04:36 AM
Karl Hanson
 
Posts: n/a
Default Re: AS/400: generate unique numbers

deebeetwo@yahoo.com wrote:
> Serge Rielau wrote:
>
>>DB2 for iSeries does support IDENTITY. Maybe you are on a backlevel version?

>
>
> You are absolutely right. I talked to the admin guy and the version is
> indeed V5R1. (By the way, is there a way to find this out from the
> system itself directly?)
>


One way to determine the OS version/release:
- On a command line run: go licpgm
- Pick option: Display installed licensed programs
- Use function key for: Display release (eg F11)

--
Karl Hanson
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 02-27-2008, 04:40 AM
RdR
 
Posts: n/a
Default Re: AS/400: generate unique numbers

You can configure it to use RRN or Relative Record Number.

Thanks,

RdR


<deebeetwo@yahoo.com> wrote in message
news:1123737015.796194.110330@g44g2000cwa.googlegr oups.com...
> It seems that on AS/400, the IDENTITY option is not available. For
> example, I cannot declare a column as "integer generated always as
> identity".
>
> Is there an alternative that I can use? The numbers that I would like
> generated do not need to be sequential.
>
> Thanks in advance!
>



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 08:18 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com