|
Willie, How's it going? Rob Berendt -- "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." Benjamin Franklin rob@xxxxxxxxx Sent by: rpg400-l-bounces@xxxxxxxxxxxx 10/28/2003 09:02 AM Please respond to RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx> To RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx> cc Subject RE: Trigger Help Willie, Let me see if I can rephrase this. Just to see if I understand this. When someone inserts a record into ZZUSER you want to add a record of this into DCSNEW. Correct? If so then your trigger program should not have an F spec for the file ZZUSER. It does not read ZZUSER. There are two parameters that are automatically passed to the program. As you can see by reading the following: http://publib.boulder.ibm.com/iseries/v5r2/ic2924/info/dbp/rbafomst02.htm#ToC_461 One parameter is bunch of fields concantenated together. The second parameter is the length of the first parameter. Among the fields in the first parameter is a 'before' and 'after' image of ZZUSER. On an insert only the 'after' is relavent. You already have all the fields in that parameter. Therefore there is no need to read this record from ZZUSER. I will caution you, that the RPG example has one questionable practice. That is that everything after position 80 should only be accessed by using the offsets. For example instead of: * Newly inserted record of ATMTRANS I 117 132 RECORD you should instead do: C eval record=substr(parm1:onoff+1:onewlen) The reason is that IBM reserves the right to change the size of FILL2 and has done so in the past, causing tons of grief for people who hardcoded their offsets. To do this you'll probably have to assign a length to the data structure instead of relying on the subfields to define the length of the DS. Pick a sizable number that will allow for growth. Ideally you would do the following (as you can see I don't use old RPG anymore) D New e ds extname(ZZUSER) qualified D Old e ds extname(ZZUSER) qualified C eval New=substr(parm1:noff+1:newlen) C eval Old=substr(parm1:oldoff+1:oldlen) Rob Berendt -- "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." Benjamin Franklin "Willie J. Moore" <WJMoore@xxxxxxxxxxxxxxx> Sent by: rpg400-l-bounces@xxxxxxxxxxxx 10/27/2003 05:24 PM Please respond to RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx> To "RPG programming on the AS400 / iSeries" <rpg400-l@xxxxxxxxxxxx> cc Subject RE: Trigger Help I am sorry about that. I want the trigger that is attached to the file 'zzuser'to call a 'cl' program when a record is entered. The 'cl' then runs a program 'trdata' that puts the data in the correct file. I did get the trigger to call the 'cl'. Now I am getting the following: 'TRDATA 13600 issued update or delete in TRDATA without prior READ or CHAIN'. I am reading 'trdata' and following through the flow of the program before trying to delete record. It must be the time change here in California. Thanks for any help. Willie.... -----Original Message----- From: rob@xxxxxxxxx [mailto:rob@xxxxxxxxx] Sent: Monday, October 27, 2003 1:30 PM To: RPG programming on the AS400 / iSeries Subject: Re: Trigger Help Willie, When a trigger program is called, it passes several parameters to the program. Neither of your programs have any parameters defined. Or, were these programs one of the numerous programs that normally update your file and you're wondering why they don't call the trigger? I suspect it is the former and not the latter. (Would have helped to put the program names in them.) You need to RTFM. This is a good link to start with: http://publib.boulder.ibm.com/iseries/v5r2/ic2924/info/dbp/rbafomst02.htm#ToC_456 It even has a sample RPG trigger program. Go through that and if you still have questions, let us know. Rob Berendt -- "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." Benjamin Franklin "Willie J. Moore" <WJMoore@calfinew ire.com> To Sent by: <rpg400-l@xxxxxxxxxxxx> rpg400-l-bounces@ cc midrange.com Subject Trigger Help 10/27/2003 03:28 PM Please respond to RPG programming on the AS400 / iSeries <rpg400-l@midrang e.com> I am trying to do my first 'Trigger' program and not having much luck. I have a file that records are written to from several programs. I currently have a CL that runs every 2mins. It reads my file and executes a program that adds the record to a query file after some exiting. What I want to do is have the CL and program run when every there is a recorded added. I am using RPG III. Here are the file layout and part of the CL and RPG program. File: 1 field called ZZUSER for 128. CL: ovrdbf file(trdata) tofile(wjmwork/zzuser) ovrdbf file(dcsnew) tofile(wjmwork/dcsnew) call pgm(wjmwork/trdata) RPG: F:trdata uf f 128 disk F:dcsnew o f 192 disk a I:trdata ns 01 I: 1 1 recid I: 8 12 badge I: 25 30 date I: 31 36 time C: again tag C: read trdata lr C: *inlr ifeq '1' C: goto endpgm C: end C:* C: recid ifne 'A' C: goto again C: else C: excpt update C: excpt delrec C: end O:dcsnew eadd update O: badge 22 O: date 17 O: time 30 O:trdata e delrec I do the following command to add the trigger: addpftrg file(wjmwork/zzuser) trgtime(*after) trgevent(*insert) pgm(wjmwork/dcscoletcl) rpltrg(*yes) I would appreciate it if some one can give me help on getting this working. It seams like it should be so simple. Thanks in advance, William Moore wjmoore@xxxxxxxxxxxxxxx <mailto:wjmoore@xxxxxxxxxxxxxxx> 805-489-5144 ex.234 _______________________________________________ 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 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.