× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hmmmm
Still don't see the advantage
Each of our line items has a unique sequence number within the order

Alan Shore
E-mail : ASHORE@xxxxxxxx
Phone [O] : (631) 200-5019
Phone [C] : (631) 880-8640
'If you're going through hell, keep going.'
Winston Churchill


-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Steve Jones
Sent: Thursday, May 04, 2017 12:18 PM
To: RPG programming on the IBM i (AS/400 and iSeries) <rpg400-l@xxxxxxxxxxxx>
Subject: Re: Trigger pgm to increment seq# in file

It is like an order detail file,

Order#, line item seq #, item number, qty



On Thu, May 4, 2017 at 11:22 AM, Alan Shore <ashore@xxxxxxxx> wrote:

Hi Steve
I'm curious - what advantage do you have for there being multiple
records with the same sequence number (but different fieldA)?

Alan Shore
E-mail : ASHORE@xxxxxxxx
Phone [O] : (631) 200-5019
Phone [C] : (631) 880-8640
'If you're going through hell, keep going.'
Winston Churchill


-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of
Steve Jones
Sent: Thursday, May 04, 2017 11:18 AM
To: RPG programming on the IBM i (AS/400 and iSeries) <
rpg400-l@xxxxxxxxxxxx>
Subject: Re: Trigger pgm to increment seq# in file

The sequence is based on a field in the file, so there could be
multiple records with same seq# Example file would be FieldA, Seq

File:

FieldA = "TEST" Seq = 1
FieldA = "TEST" Seq = 2
FieldA = 'ROB' Seq = 1
FieldA = 'STEVE' Seq = 1

On Thu, May 4, 2017 at 11:12 AM, Rob Berendt <rob@xxxxxxxxx> wrote:

I don't understand your question.


Rob Berendt
--
IBM Certified System Administrator - IBM i 6.1 Group Dekko Dept 1600
Mail to: 2505 Dekko Drive
Garrett, IN 46738
Ship to: Dock 108
6928N 400E
Kendallville, IN 46755
http://www.dekko.com





From: Steve Jones <sjones@xxxxxxxxxxxxxxx>
To: "RPG programming on the IBM i (AS/400 and iSeries)"
<rpg400-l@xxxxxxxxxxxx>
Date: 05/04/2017 11:05 AM
Subject: Re: Trigger pgm to increment seq# in file
Sent by: "RPG400-L" <rpg400-l-bounces@xxxxxxxxxxxx>



Never saw a identity column before, that would be perfect.

Can the number be based on like key field? In your example:

1, A, 1
1, A, 2
2, B, 1

On Thu, May 4, 2017 at 10:18 AM, Rob Berendt <rob@xxxxxxxxx> wrote:

As Birgitta said, a before insert is what you want.

I do have to ask though. Why not use an identity column and have
the system autoincrement it for you?

Create table...
myKeyColumn int as identity,
...

Or perhaps a sequence object? Below is a tested example of
sequence created with "Run SQL Scripts":

set current schema rob;

create or replace sequence NextKey;

create table scuzz (
myKeyColumn int as identity,
SomeOtherColumn char(5),
CounterNumber int);

insert into scuzz
(SomeOtherColumn, CounterNumber)
values ('A', next value for NextKey);

insert into scuzz
(SomeOtherColumn, CounterNumber)
values ('B', next value for NextKey);

select * from scuzz;
you will see:
1, A, 1
2, B, 2

values previous value for NextKey; You will see: 2

If you want to know what object it creates try DSPDTAARA. It's
rather complex though.
Data area . . . . . . . : NEXTKEY
Library . . . . . . . : ROB
Type . . . . . . . . . : *CHAR
Length . . . . . . . . : 2000
I think it uses all that space to keep track of last accessed
information.

Rob Berendt
--
IBM Certified System Administrator - IBM i 6.1 Group Dekko Dept
1600 Mail to: 2505 Dekko Drive
Garrett, IN 46738
Ship to: Dock 108
6928N 400E
Kendallville, IN 46755
http://www.dekko.com





From: Steve Jones <sjones@xxxxxxxxxxxxxxx>
To: rpg400-l@xxxxxxxxxxxx
Date: 05/04/2017 09:13 AM
Subject: Trigger pgm to increment seq# in file
Sent by: "RPG400-L" <rpg400-l-bounces@xxxxxxxxxxxx>



We have a file that contains a sequence number for each unique key
in
the
file, file is defined like this:

Filea:
Field1 (key1)
Field2 (key2)
sequence number (starts at 1)

We want to have a trigger program fire when a record is added to
set the sequence number of the new record to be the next #.

So I tried adding a trigger with trigger time of *after & event
*insert, that fails because the record is still in use.

Seems like a simple idea, but we are missing something.

Thanks

--
Steve Jones
H-P Products, Inc
330-871-2054

--
NOTE: The information in this email is confidential and may be
legally privileged. If you are not the intended recipient, you
must not read,
use
or disseminate the information; please advise the sender
immediately by reply email and delete this message and any
attachments without
retaining
a
copy. Although this email and any attachments are believed to be
free
of
any virus or other defect that may affect any computer system into
which it is received and opened, it is the responsibility of the
recipient to ensure that it is virus free and no responsibility is
accepted by H-P Products, Inc. for any loss or damage arising in
any way from its use.
--
This is the RPG programming on the IBM i (AS/400 and iSeries)
(RPG400-L) mailing list To post a message email:
RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list
options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please
take a moment to review the archives at
http://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our
affiliate
link: http://amzn.to/2dEadiD


--
This is the RPG programming on the IBM i (AS/400 and iSeries)
(RPG400-L) mailing list To post a message email:
RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list
options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please
take a moment to review the archives at
http://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our
affiliate
link: http://amzn.to/2dEadiD




--
Steve Jones
H-P Products, Inc
330-871-2054

--
NOTE: The information in this email is confidential and may be
legally privileged. If you are not the intended recipient, you must
not read, use or disseminate the information; please advise the
sender immediately by reply email and delete this message and any
attachments without retaining a copy. Although this email and any
attachments are believed to be free of any virus or other defect
that may affect any computer system into which it is received and
opened, it is the responsibility of the recipient to ensure that it
is virus free and no responsibility is accepted by H-P Products,
Inc. for any loss or damage arising in any way from its use.
--
This is the RPG programming on the IBM i (AS/400 and iSeries)
(RPG400-L) mailing list To post a message email:
RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list
options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take
a moment to review the archives at http://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our
affiliate
link: http://amzn.to/2dEadiD


--
This is the RPG programming on the IBM i (AS/400 and iSeries)
(RPG400-L) mailing list To post a message email:
RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list
options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take
a moment to review the archives at http://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our
affiliate
link: http://amzn.to/2dEadiD




--
Steve Jones
H-P Products, Inc
330-871-2054

--
NOTE: The information in this email is confidential and may be
legally privileged. If you are not the intended recipient, you must
not read, use or disseminate the information; please advise the sender
immediately by reply email and delete this message and any attachments
without retaining a copy. Although this email and any attachments are
believed to be free of any virus or other defect that may affect any
computer system into which it is received and opened, it is the
responsibility of the recipient to ensure that it is virus free and no
responsibility is accepted by H-P Products, Inc. for any loss or damage arising in any way from its use.
--
This is the RPG programming on the IBM i (AS/400 and iSeries)
(RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at http://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: http://amzn.to/2dEadiD

--
This is the RPG programming on the IBM i (AS/400 and iSeries)
(RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at http://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: http://amzn.to/2dEadiD




--
Steve Jones
H-P Products, Inc
330-871-2054

--
NOTE: The information in this email is confidential and may be legally privileged. If you are not the intended recipient, you must not read, use or disseminate the information; please advise the sender immediately by reply email and delete this message and any attachments without retaining a copy. Although this email and any attachments are believed to be free of any virus or other defect that may affect any computer system into which it is received and opened, it is the responsibility of the recipient to ensure that it is virus free and no responsibility is accepted by H-P Products, Inc. for any loss or damage arising in any way from its use.
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: http://amzn.to/2dEadiD


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.