|
Dan, Perhaps you should look at MONITOR blocks to handle I/O errors. IMO, trapping I/O errors cannot really be standardized, or rather, only minimal handling can be managed in standardized procedures. Also, in terms of your current approach, I think you'd get better information from the File Information Data-structure. Take a look at Chapter 5 of the Programming Reference. Also examine the POST opcode. Eric DeLong Sally Beauty Company MIS-Project Manager (BSG) 940-898-7863 or ext. 1863 -----Original Message----- From: Dan [mailto:dbcerpg@yahoo.com] Sent: Thursday, February 13, 2003 10:54 AM To: rpg400-l@midrange.com Subject: file in error not showing up in PSDS As a baby step (for our shop) into the world of service programs, I am attempting to externalize what are now several subroutines into external procedures. The function serves to trap and handle file I/O errors such as RNX1211 "I/O operation was applied to closed file CUSTMAST." I was hoping that we could capture the filename in the Program Status Data Structure, but the filename is not found in any fixed location. Yes, it is in the error message that appears in the PSDS, but the filename itself can't be counted on to be in any fixed location. The RPG reference indicates that positions 175 - 184 represent "Name of file on which the last file operation occurred (updated only when an error occurs). This information always contains the full file name." This is the same for both v4r5 & v5r2. The implication seems to be that when a file error occurs, that filename will be placed in that PSDS subfield. However, I wonder if "successfully" should be inserted between "operation" & "occurred", because this area (subfield SDSFILERR) is always blank in my testing of: FCustMast IF E K DISK usropn DSDSDS SDS 2048 D SDSPGMNAM *PROC D SDSSTATUS *STATUS D SDSERRMSG 91 170 D SDSFILERR 175 184 D ZBIGENCHILADA 1 2048 C LR Open CustMast C READ CustMast C eval *inLR = *on (Note that this is not an example of our shop's code; it is just to test this issue.) Have I uncovered a bug in the compiler? Or have I misinterpreted the definition in the reference? So, our current workaround is to do a "WHEN %STATUS(filename) > *ZERO" test for each and every file defined in the program. Which makes it impossible to turn this routine into a service program. Advice would be appreciated. - Dan __________________________________________________ Do you Yahoo!? Yahoo! Shopping - Send Flowers for Valentine's Day http://shopping.yahoo.com _______________________________________________ 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/mailman/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-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.