MIDRANGE dot COM Mailing List Archive



Home » MIDRANGE-L » July 2014

Re: Triggers



fixed

Not clear to me why you are inserting a record with one field.

Wouldn't you be better normalizing your structure to something like:

CREATE TABLE STATUS_TABLE (
ID FOR STID BIGINT GENERATED ALWAYS AS IDENTITY
(START WITH 1,
INCREMENT BY 1,
NO ORDER,
NO CYCLE,
NO MINVALUE,
NO MAXVALUE, CACHE 20) NOT HIDDEN ,
STAMP_ENTERED FOR STENTERED TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
NOT HIDDEN ,
TYPE FOR STTYPE BIGINT NOT NULL NOT HIDDEN ,
COUNT FOR STCOUNT INTEGER NOT NULL NOT HIDDEN ,
PRIMARY KEY (ID) ) NOT VOLATILE RCDFMT RTABLE UNIT ANY ;

RENAME STATUS_TABLE TO SYSTEM NAME STTABLE;

LABEL ON TABLE STATUS_TABLE IS 'Order Status Table.' ;

LABEL ON COLUMN STATUS_TABLE (
ID TEXT IS 'ID' ,
STAMP_ENTERED TEXT IS 'When written' ,
TYPE TEXT IS 'Type of Status' ,
COUNT TEXT IS 'Current Count' );

LABEL ON COLUMN STATUS_TABLE (
ID IS 'ID ' ,
STAMP_ENTERED IS 'When
Written ' ,
TYPE IS 'Type Of Status ' ,
COUNT IS 'Current Count '
);

TYPE is just a identity key of table defining all the types.


On Tue, Jul 8, 2014 at 11:01 AM, Hoteltravelfundotcom <
hoteltravelfun@xxxxxxxxx> wrote:

this is the table created. this file TRNSTAT2 holds the order status
changes. we want to update -trigger our tables when TRNSTAT2 changes.

Drop table ISTLIB.CUSCINx;

CREATE table ISTLIB.CUSCINx(
PROGR2PST int, PROGR2PUN int, PROGR2TOD int, PROGR2TUN int,
PROGR2TOM int, PROGR2MUN int, LASGR2PST int, LASGR2PUN int,
LASGR2TOD int, LASGR2TUN int, LASGR2TOM int, LASGR2MUN int,
PCKGR2PST int, PCKGR2PUN int, PCKGR2TOD int, PCKGR2TUN int,
PCKGR2TOM int, PCKGR2MUN int, ASSGR2PST int, ASSGR2PUN int,
ASSGR2TOD int, ASSGR2TUN int, ASSGR2TOM int, ASSGR2MUN int,
SHPGR2PST int, SHPGR2PUN int, SHPGR2TOD int, SHPGR2TUN int,
SHPGR2TOM int, SHPGR2MUN int, HLDGR2PST int, HLDGR2PUN int,
HLDGR2TOD int, HLDGR2TUN int, HLDGR2TOM int, HLDGR2MUN int);

--
-- Count for Previous Day
Insert into ISTLIB.CUSCINx(PROGR2PST)
SELECT count(*) FROM ASTCCDTA.OEORH48,ASTCCDTA.TRNSTAT2,ASTCCDTA.OETRA99
WHERE OHCOM# = TSCOM# AND OHORD# = TSORD#
AND (otCOM# = OHCOM# AND OTORD#= OHORD# AND ottrnc = 'AQC')
AND TSSTAT
IN('AEP','BGE')
AND OHORDT
IN('CUS','CIN','SMC','COC','DON')
AND OHREQD < replace(char(current date, iso), '-', '') AND OHHLDC = ' '
AND
OHORD# in(SELECT a.TSORD# FROM ASTCCDTA.TRNSTAT2
a
WHERE a.tsstat
IN('AEP','BGE','EAS','REL','STP'));




On Tue, Jul 8, 2014 at 12:56 PM, Alan Campin <alan0307d@xxxxxxxxx> wrote:

We did the same thing at my previous company except on a huge scale. A
hundred or more all using the Trigger Mediator. I have a new version. I
have just not got my lazy ass to send it out.


On Tue, Jul 8, 2014 at 10:48 AM, Hoteltravelfundotcom <
hoteltravelfun@xxxxxxxxx> wrote:

OK i have 5 tables that are going to have changes made based. these
tables
are created from several files. when a change occurs on one of the
files. i
need that change to my tables.



On Tue, Jul 8, 2014 at 11:32 AM, Buck Calabro <kc2hiz@xxxxxxxxx>
wrote:

On 7/8/2014 9:57 AM, Hoteltravelfundotcom wrote:
For triggers use, I just need to setup one time and nothing else is
needed
to do? this command is all? ADDPFTRG

The probable answer is yes.

Without understanding whether you are using an SQL trigger or a
trigger
written in an HLL, there may be more design information that would be
interesting to you. Look up Alan Campin Trigger Mediator.
--buck

--
This is the Midrange Systems Technical Discussion (MIDRANGE-L)
mailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.


--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.


--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.


--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.







Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2014 by MIDRANGE dot 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 here. If you have questions about this, please contact