|
Couple of different ways to approach this. 1) Now that you can get the error code from the PSDS you can use some techniques to retrieve the message from the program message queue and go from there. However, where do you go from there? 2) Assume that if you get a referential constraint error on an add that it is because of one particular file. This can bite you in the butt. As an order header record probably access many parent files. Maybe you can use the information gleaned from option 1 to resolve it. Of course a table might be a good thing for the users: PROCUS means ... But, if you have decent definitions on your files then a RTVOBJD or some such API may work. Then your service program could come up with a generic routine 1st level) Record could not be added to &1 because key &2 is not in &3. 2nd level) Either use a valid value for a &3 record, or maintain the &3 file. I would use the table, or RTVOBJD values for &1 and &3. The key might be a trick. I don't suppose you can pass key lists as parms can you? Might take two subprocedures. One to determine the files in question. Then the main program would determine the key. Then the second subprocedure could display the error. Rob Berendt İİİİİİİİİİİÚ smart person learns from their mistakes, but a wise person learns from OTHER peoples mistakes. Buck Calabro <Buck.Calabro@com To: rpg400-l@midrange.com msoft.net> cc: Sent by: Fax to: rpg400-l-admin@mi Subject: RE: Constraint Violations drange.com 10/04/2001 09:02 AM Please respond to rpg400-l Rob wrote: >Does it appear in the Program Status Data Structure in any of >these related fields: >.....DName+++++++++++ETDsFrom+++To/L+++IDc > D EXCP_MSG 40 46 > ¦ D EXCP_TYPE 40 42 > ¦ D EXCP_NUM 43 46 > ¦ D PGM_LIB 81 90 > ¦ D EXCP_DATA 91 170 > ¦ D LAST_FILE 201 208 Alas, no. The first level text ends up in EXCP_DATA EXCP_DATA CHAR(80) 'Referential constraint violation on member PROMAS. Here's the full message: Message ID . . . . . . : CPF502D Severity . . . . . . . : 30 Message . . . . : Referential constraint violation on member PROMAS. Cause . . . . . : The operation being performed on member PROMAS file PROMAS in library BUCK failed. Constraint PROMAS_CUSTOMER_ID prevents record number 40 from being inserted or updated in member PROMAS of dependent file PROMAS in library BUCK because a matching key value was not found in member PROCUS of parent file PROCUS in library BUCK. If the record number is zero, then the error occurred on an insert operation. The constraint rule is 2. The constraint rules are: 1 -- *RESTRICT 2 -- *NOACTION Program status is 00001 File status is 01022 --buck _______________________________________________ This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@midrange.com To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l or email: RPG400-L-request@midrange.com 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-2025 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.