× 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.



Looking at Datastructure I/O support - I'm not quite clear on:

" When a data structure is defined for a record format of a DISK file using
LIKEREC without the second parameter, and the output buffer layout is
identical to the input buffer layout, the data structure can be used as the
result data structure for any I/O operation."

Forgive my ignorance but I haven't had cause to use the DS I/O Support.

Why would the Input Buffer be different to the output Buffer - is this to
do with things like generated columns for ID and row change timestamps etc?

thanks,
Craig

On 14 June 2018 at 14:51, Craig Richards <craig@xxxxxxxxxxxxxxxx> wrote:

Hi Dave and Charles,

thanks for taking the time to reply.

Between calls:
All files are closed.
All cursors are closed.
The activation group is deleted.

There is one SQL Index on the file. It's not unique.

The GENERATED is cut and pasted from the DDL directly as above:

generated always as identity ( start with 1 increment by 1 cycle )
primary key

No Overriding System value clause.

It seems very odd to me.
I'm leaning towards changing the code to use SQL for the insert and using
DEFAULT for the ID column but there are several programs to change...

I'll do a bit more testing to try to confirm that it is related to the
environment switch but I can't for the life of me see what resource could
be left over from the previous call.

thanks as always,
Craig


On 14 June 2018 at 14:42, Charles Wilt <charles.wilt@xxxxxxxxx> wrote:

GENERATED ALWAYS should ignore the what RPG passes in...

GENERATED BY DEFAULT would cause this problem...

Another possible source...do you have an SQL process that does an INSERT
with the "OVERRIDING SYSTEM VALUE" clause?

Charles


On Thu, Jun 14, 2018 at 6:41 AM Craig Richards <craig@xxxxxxxxxxxxxxxx>
wrote:

Hi All,

I have some files with Identity Columns typically defined something
like:

MsgCnt_UniqueID for column UniqueID Integer
not Null
generated always as identity ( start with 1 increment by 1 cycle )
primary key

When performing writes to a table with one of these fields using RGPLE
RLA
I thought that the UniqueID column in the RPG program was just ignored
and
a new unique ID assigned.

However I find I'm sometimes getting some duplicate key errors which are
definitely with the Table ( not other indices ) and the primary key on
the
table is just the identity column.

Obviously with an SQL Write, I can specify a list of fields, excluding
the
identity column.

In RPG is it necessary to use Data Structures on the DB operations to
also
specify a list of fields which excludes the ID column?

I haven't convinced myself 100 percent, but this issue only seemed to
appear when I was calling the program and then switching library lists
and
calling the program again.

There is a subfile program and maintenance screen which use the same
service program for DB access which all run in Activation Group QILE.
But
these are called via a wrapper CL which does a RCLACTGRP between calls.

I'm a little stumped about what is causing this intermittent issue.
Is it dodgy to perform RLA with an identify column defined as above?
Or are there any special considerations I'm missing?

thanks kindly for any comments.

best regards,
Craig
--
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: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://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: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://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 ...

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.