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



I will check out the RPG-L list. Good to know there is a list that has some
intense SQL guys, it will come in handy knowing that!

Thanks for the help Rob,
Robert Newton
EDPS
Electronic Data Processing Services
Software Engineer
rnewton@xxxxxxxxxxxxxxxxx

This communication is confidential and is intended to be privileged. If
there is a problem with this transmission, please contact the sender. If
the reader of this message is not the intended recipient, or the employee
or agent responsible to deliver it to the intended recipient, you are
hereby notified that any dissemination, distribution or copying of this
communication is strictly prohibited.



rob@xxxxxxxxx
Sent by:
rpg400-l-bounces@ To
midrange.com RPG programming on the AS400 /
iSeries <rpg400-l@xxxxxxxxxxxx>
cc
10/30/2007 04:49
PM Subject
Re: AW: AW: DB2 Check Constraints -
Reference a control file
Please respond to
RPG programming
on the AS400 /
iSeries
<rpg400-l@midrang
e.com>






Glad the trigger is working for you. I'd like to understand this further,
but since you have a working solution, and you and I are probably both
busy people, I'll drop it.

midrange-l list would have been fine. I wasn't just picking on you.
There's a lot of questions coming through here that aren't really just
rpg. Not only that but there are some really intense SQL people on
midrange-L that don't frequent the RPG list that might have been of
assistance for you.

Rob Berendt
--
Group Dekko Services, LLC
Dept 01.073
PO Box 2000
Dock 108
6928N 400E
Kendallville, IN 46755
http://www.dekko.com





RNewton@xxxxxxxxxxxx
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
10/30/2007 04:20 PM
Please respond to
RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>


To
RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>
cc

Fax to

Subject
Re: AW: AW: DB2 Check Constraints - Reference a control file






Rob,

Thanks for the reply. The reason I could not achieve this with a
referential constraint was two fold (as I mentioned in the original
email).
First there were no primary keys in the file, and second the file is
coded.
Meaning I need to hit the file for a particular value in a group type of
field before I can get my set of valid values. Without that value being a
part of my keys in my child table I was unaware of how a referential
constraint would have worked. Fill me in if you know how I could have done
this better considering that fact.

By the way, the suggestion of a before trigger worked perfectly. I have
implemented before triggers only in the situations where a check
constraint
cannot handle the validation required. Anywhere else, a simple check
constraint is used.

As for posting in the wrong list... I apologize for cluttering up your
inbox. I looked for a DB2/SQL list but did not see one:
http://www.midrange.com/lists.htm, then I figured that from the different
topics I have read on this list that there would be a number of folks with
the knowledge to help me out with the issue. (Thanks Birgitta) Next time I
will think twice about posting here and simply post somewhere else more
related to the topic.

Thanks again everyone,
Robert Newton
EDPS
Electronic Data Processing Services
Software Engineer
rnewton@xxxxxxxxxxxxxxxxx

This communication is confidential and is intended to be privileged. If
there is a problem with this transmission, please contact the sender. If
the reader of this message is not the intended recipient, or the employee
or agent responsible to deliver it to the intended recipient, you are
hereby notified that any dissemination, distribution or copying of this
communication is strictly prohibited.



rob@xxxxxxxxx
Sent by:
rpg400-l-bounces@ To

midrange.com RPG programming on the AS400 /
iSeries <rpg400-l@xxxxxxxxxxxx>
cc

10/30/2007 01:20
PM Subject

Re: AW: AW: DB2 Check Constraints -

Reference a control file
Please respond to
RPG programming
on the AS400 /
iSeries
<rpg400-l@midrang
e.com>






Why not store these values into another file, and use a referential
constraint instead of a check constraint or a before trigger? You
mentioned something like the original file did not have a primary key. So,
add one with ADDPFCST. Granted, it was common with ancient software
packages to never put a primary key on a file because of some supposed bug
in V1 of CPF on the S/38, but, you know, I think we're past that.

If you don't want to mess with the table file containing the values, then
copy the records to a new file that DOES have a primary key. And put a
trigger on the existing table file that any new maintenance will update
the duplicate table. This way you do not have to modify the vendor code
to sync the two files.

ie, if your values are in this table
create table ROB/ValueTable (
ValueCode char(3),
ValueDesc char(20),
primary key (ValueCode))

and you want to ensure that they match in this file
create table ROB/DataTable (
DataKey int,
DataDesc char(20),
ValueCode char(3),
primary key (DataKey),
foreign key (ValueCode) references ValueTable(ValueCode))

Then just set it up like that.

Rob Berendt
--
Group Dekko Services, LLC
Dept 01.073
PO Box 2000
Dock 108
6928N 400E
Kendallville, IN 46755
http://www.dekko.com





RNewton@xxxxxxxxxxxx
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
10/28/2007 12:41 PM
Please respond to
RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>


To
RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>
cc

Fax to

Subject
Re: AW: AW: DB2 Check Constraints - Reference a control file






Then it would make sense for me to use check constraints whenever I can
and
leave the before triggers only for the RI checks that cannot be
accomplished natively with a check constraint.

Thanks for the help.

Robert Newton
EDPS
Electronic Data Processing Services
Software Engineer
rnewton@xxxxxxxxxxxxxxxxx

This communication is confidential and is intended to be privileged. If
there is a problem with this transmission, please contact the sender. If
the reader of this message is not the intended recipient, or the employee
or agent responsible to deliver it to the intended recipient, you are
hereby notified that any dissemination, distribution or copying of this
communication is strictly prohibited.



"BirgittaHauser"
<Hauser@sss-softw
are.de> To

Sent by: "'RPG programming on the AS400 /
rpg400-l-bounces@ iSeries'" <rpg400-l@xxxxxxxxxxxx>
midrange.com cc


Subject

10/28/2007 12:38 AW: AW: DB2 Check Constraints -
PM Reference a control file


Please respond to
RPG programming
on the AS400 /
iSeries
<rpg400-l@midrang
e.com>






Hi,

A check constraint is be directly executed by the database manager, while
using a trigger always a dynamic program call, with all overhead occurs.


Mit freundlichen Grüßen / Best regards

Birgitta Hauser

"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training
them
and keeping them!"

-----Ursprüngliche Nachricht-----
Von: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
Im
Auftrag von RNewton@xxxxxxxxxxxx
Gesendet: Sunday, October 28, 2007 17:16
An: RPG programming on the AS400 / iSeries
Betreff: Re: AW: DB2 Check Constraints - Reference a control file


Birgitta,

Is there a signifigant performance difference between implementing row
level
security in a before trigger vs a check constraint?

Thanks,
Robert Newton
EDPS
Electronic Data Processing Services
Software Engineer
rnewton@xxxxxxxxxxxxxxxxx

This communication is confidential and is intended to be privileged. If
there is a problem with this transmission, please contact the sender. If
the
reader of this message is not the intended recipient, or the employee or
agent responsible to deliver it to the intended recipient, you are hereby
notified that any dissemination, distribution or copying of this
communication is strictly prohibited.



"BirgittaHauser"
<Hauser@sss-softw
are.de> To
Sent by: "'RPG programming on the AS400 /
rpg400-l-bounces@ iSeries'" <rpg400-l@xxxxxxxxxxxx>
midrange.com cc

Subject
10/28/2007 05:14 AW: DB2 Check Constraints -
AM Reference a control file


Please respond to
RPG programming
on the AS400 /
iSeries
<rpg400-l@midrang
e.com>






Hi,

1. you cannot use check constraints to check values in an other table.
A check constraint can only compare with hard coded values or with
values
stored
in a column in the same row in your table.

2. If you need to check values in an other table, you need to implement a
before trigger program.
This trigger program gets activated as soon as the event (insert or
update) occurs.
In your trigger program you check if the inserted value can be found in
your control table.
If the value cannot be found in the table you need to send an escape
message (or SIGNAL) the error
and handle it in the caller procedure.

Mit freundlichen Grüßen / Best regards

Birgitta Hauser

"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok) "What is
worse than training your staff and losing them? Not training them and
keeping them!"

-----Ursprüngliche Nachricht-----
Von: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
Im
Auftrag von RNewton@xxxxxxxxxxxx
Gesendet: Sunday, October 28, 2007 00:25
An: rpg400-l@xxxxxxxxxxxx
Betreff: DB2 Check Constraints - Reference a control file



I have been reading a lot today trying to figure out a way that I can
setup
a check constraint for a 3a column in a table to reference a control file
that holds all the fields valid (allowed) values.

The control file has been around for years used by edit routines in RPG.
It
has a key field that groups the records together. Then there is a values
field which holds the valid values. I would need to hit the file for a
certain group value in the key field then check if the value being
inserted
into my table is found in the control file under that goup. The control
table has no "primary" keys. So setting up a foreign key constraint is
unsuccessful. Regardless, in a FKC there would be no way to specify the
group key value.

My goal is to be able to keep all of the valid values for validation in
this
control file to ensure that I do not disturb existing processes and to
have
one point in which to update them. I have tried setting up a check
constraint that does a subselect but I quickly learned that is outside of
the scope of a check condition.

Has anyone else tried to do this same thing before with any success? Can
you
offer any insight on how I may accomplish this?

Thanks in advance,
Robert Newton
EDPS
Electronic Data Processing Services
Software Engineer
rnewton@xxxxxxxxxxxxxxxxx

This communication is confidential and is intended to be privileged. If
there is a problem with this transmission, please contact the sender. If
the
reader of this message is not the intended recipient, or the employee or
agent responsible to deliver it to the intended recipient, you are hereby
notified that any dissemination, distribution or copying of this
communication is strictly prohibited.

--
This is the RPG programming on the AS400 / 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.





--
This is the RPG programming on the AS400 / 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.




--
This is the RPG programming on the AS400 / 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.





--
This is the RPG programming on the AS400 / 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.




--
This is the RPG programming on the AS400 / 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.


--
This is the RPG programming on the AS400 / 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.




--
This is the RPG programming on the AS400 / 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.


--
This is the RPG programming on the AS400 / 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.





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.