1
votes

I've been tasked with finding a way to migrate data into a DB2 AS400 database. When the data is entered (currently manually) on the front end, the system is doing some calculations and inserting the results in a table.

My understanding is that it's using a trigger to do so. I don't know very much about this stuff, but I have written code to directly insert values into that same table. Is there a way for me to figure out what trigger is being fired when users enter data manually?

I've looked in QSYS2/SYSTRIGGERS and besides not making much sense to me, I see no triggers that belong to the SCHEMA with my table in it.

Any help here would be awesome, as I am stuck.

1
What does entered (currently manually) on the front end mean? Data entry into a formatted screen? If so, then "trigger" seems unlikely. - user2338816
It's an old piece of oil and gas allocation software. From the system menu you type 'CALL ARTESIA' and then navigate through various menus until you get to the point where you manually type information off of paper. When you hit the enter key, the information is inserted into the file(table) associated with that screen. You only enter in about 8 pieces of data. Based on what you enter 60 columns are filled in with some of them being calculated (specifically a volume correction factor for oil at a measured API outside of 60 degrees). I used front end to describe the user interface. - ajthyng
So, it's a BEFORE INSERT trigger? That would make clear good sense. - user2338816
I wish I knew enough to answer that, but I never was able to find the right trigger. It's definitely doing something, because about 12 pieces of user input become a single entry in a table with 60 columns, and all of the columns are filled out. - ajthyng
Sounds like an old green screen (5250) program. It'd be unusual for triggers to be being used. All the logic would be in the program itself. That's just how it was done 20 years ago. - Charles

1 Answers

4
votes
SELECT *
FROM QSYS2.SYSTRIGGERS
WHERE TABSCHEMA = 'MYSCHEMA' 
      AND TABNAME = 'MYTABLE'

Should work fine.

If you'd prefer to use a 5250 command line, the Display File Description (DSPFD) command will show you the triggers on a file (table)

DSPFD FILE(MYSCHMA/MYTABLE) TYPE(*TRG)

Lastly, trigger information is available via the IBM i Navigator GUI. Either the older fat client version or the newer web based one.