473,578 Members | 2,739 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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!

Nov 12 '05 #1
8 2850
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.

Nov 12 '05 #2
de*******@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
Nov 12 '05 #3
Anton Versteeg wrote:
de*******@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
Nov 12 '05 #4
de*******@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
Nov 12 '05 #5
4.****@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.


Nov 12 '05 #6
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


Nov 12 '05 #7
de*******@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
Nov 12 '05 #8
RdR
You can configure it to use RRN or Relative Record Number.

Thanks,

RdR
<de*******@yaho o.com> wrote in message
news:11******** **************@ g44g2000cwa.goo glegroups.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!

Nov 12 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
8280
by: Laphan | last post by:
Hi All This is a strange request, but I just cannot fathom how to do it. In theory the requirement is very basic, but in practise its a noodle!! I have 10 team names like so: Team A Team B
6
3807
by: Sebastien | last post by:
Hi, I am building a products database, linking sales and production. Each part has a unique sales Stock Code and Production Number. The sales stock code is a combination of letters and numbers taken from the part name (BrandA 300 4 Bladed : B3004B). The production number is a 4 or 5 digits number with first figure(s) indicating category...
2
4527
by: Chris Dunaway | last post by:
I have a web service which is accessed by a windows forms application. When the application submits a unit of work (a "job"), I want to return a job receipt or tracking number back to the application. My requirements are these: 1. The receipt number must be unique (like a guid is unique) 2. The receipt must be NON sequential. 3. If...
6
2769
by: Anamika | last post by:
I am doing a project where I want to generate random numbers for say n people.... These numbers should be unique for n people. Two people should not have same numbers.... Also the numbers should not be repeted.. Do anyone have some nice algorithm for that? Or anyone can suggest me any type of book or site for that purpose?
1
3640
by: Daniel Hilgarth | last post by:
Hello, I am currently trying to use XSLT for the creation of multiple HTML-files from a single XML-File. This HTML-files need to have links to each other. The following information might be important: There are some special nodes that will start a new HTML-page ("page-nodes"). Those nodes can be nested. Those nodes have an attribute...
8
7194
by: Marc | last post by:
Hi all, I have to generate and send to a printer many 6 digit alphanumeric strings. they have to be unique but I cannot check in a database or something like that if it have already been printed. the string has also to seem a random one and it cannot have an apparence of a sequence. My first approach is to do it with a decimal counter and...
24
7196
by: pereges | last post by:
I need to generate two uniform random numbers between 0 and 1 in C ? How to do it ? I looked into rand function where you need to #define RAND_MAX as 1 but will this rand function give me uniformly distributed and unique numbers ?
8
2932
pradeepjain
by: pradeepjain | last post by:
i am creating a a form where in patients are registered and given a unique ID number(serial numbers) . and i need generate a pin number along with this id for him . which is the best way to generate a pin numbers for users (like that of credit cards). so that its unique for each patients.
0
7850
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7779
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8126
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7874
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6524
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3786
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3801
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1391
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1114
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.