How can I find on which files a program has been attached as an external trigger?

Application development
I have a "generic" rpgle program that can be attached to any physical file as a trigger. And so it has been, many times.. Is there a utility that I can use to find exactly what files have this program attached as a trigger? Or some table where I can look? Thanks! Kevin

Answer Wiki

Thanks. We'll let you know when a new response is added.

The command PRTTRGPGM creates a listing of all the trigger programs in the specified library(ies) and the physical files they are attached to. It also creates a member in the file QSECTRGOLD in library QUSRSYS, with the name of the library scanned by the command. You can query this file to find the information you want.

Discuss This Question: 3  Replies

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • Whanzens
    The PRTTRGPGM can be used to see all trigger programs of all files in one library. This command uses files in qtemp to print the report and deletes the files afterwards. If you can't get your info from the report it might be possible to do a trcjob to see what programs are used by the cmd and do call yourself (this can be differcult/triggy). If you need this info over your whole system, you can write a clp to do a dspobjd qsys/*all *lib to an outfile, read the outfile with dclf/rcvf, do a prttrgpgm for each lib. and copy the spooled file to a temp pf (rcdlen(132)) with the cpysplf cmd and copy the first pf to a second pf (with fields for the colums in the report) with a selection on the on pos 62 and fmtopt(*nochk). You're then able to use sql to do all selections/sorts you require on the second file. There might be easier or better methods, but I don't use triggers to much and haven't had your problem. Wim
    0 pointsBadges:
  • Alasdair727
    If the program is used a lot, you can also query the file QSYS/QADBXTRIGB or it's logical QSYS2/SYSTRIGGER. This has every file with a trigger on it on the system. QADBXTRIGB has OS/400 native naming conventions but little text on the fields, while SYSTRIGGER gives you more of a clue what each field is used for but expands them all to SQL standard i.e. 128 characters wide. You should be able to find what you need there.
    0 pointsBadges:
  • Beercheck
    Bingo! Thanks everyone. Querying the system file SYSTRIGGER gives me everything I need. It's exactly the sort of solution I'd hoped for.
    0 pointsBadges:

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.


Share this item with your network: