|
Perhaps they are null until they are passed in. I've written RPGLE programs to accept parameters from a command. My sample command is RTVJOBD. Some parameters are optional. And they are not necessarily at the end, so checking for the number of parameters is out. What I had to do is the following: C *Entry Plist C Parm JobDFLib 20 C Parm JobQNameP C Parm JobQLibP C Parm JobPtyP ... If %addr(JobPtyP) <> *NULL Eval JobPtyP = JobPty EndIf ... Otherwise my program would abend with some MCH error if I didn't check to see if the address of JobPtyP was null. Rob Berendt ================== Remember the Cole! "Steve Brazzell" <steve@brazzell.c To: <RPG400-L@midrange.com> om> cc: Sent by: Subject: RPG Trigger Programs -- IBM "sample program" Error owner-rpg400-l@mi drange.com 11/01/00 06:58 AM Please respond to RPG400-L Just thought I'd pass this along for any of you who have written or plan to write RPG trigger programs. In the "DB2 for OS/400 Database Programming" manuals, from V3R2 through V4R3, there is a very small yet dangerous error in the RPG sample trigger program. I discovered this yesterday while assisting my client in a move from a CISC V3R2 to a RISC V4R4 machine. The *ENTRY PLIST in these manuals is shown this way: ****************************************************************** * SET UP THE ENTRY PARAMETER LIST. ****************************************************************** C *ENTRY PLIST C PARM1 PARM PARM1 C PARM2 PARM PARM2 ****************************************************************** This is wrong, but may or may not show up as an intermittent problem (depending on what is in memory where and when). The corrected sample program first shows up in the V4R4 manual, which lists the same trigger program, but with the entry parms shown like this: ****************************************************************** * SET UP THE ENTRY PARAMETER LIST. ****************************************************************** C *ENTRY PLIST C PARM PARM1 C PARM PARM2 ****************************************************************** My discovery of this came when we began getting MCH3601 (Pointer not initialized, or some such wording) errors when files with a trigger program were modified. After pulling out all of my hair (actually, I do have a few strands left), I discovered this difference, changed the code to that shown in the latter example, and the problem went away. I currently had a call in to IBM and, after my discovery, actually got one of the RPG Compiler guys on the phone who said that, indeed, the earlier sample was incorrect and prone to causing problems, but no one caught it until V4R4 docs were being produced. It also turns out, according to the IBM people I had on the phone, that this change was never *noted* as such to alert customers to the potential problem. So, if you have any trigger programs that you based on the sample, make sure they look like the bottom example, not the top, regardless of the version of the OS you're on. Also, I'd be interested in an explanation of exactly why the first example would cause a problem. The "PARM1" and "PARM2" in the result field get moved to the corresponding data structures in the factor 1 column (in this case, themselves) upon program invocation. I'm still not clear why this would cause a problem as the structures are the same size, by definition. Anyone want to tackle this one?? Steve Brazzell Innovatum, Inc. +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +--- +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
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.