How To Handle Decimal Data Error In Rpg
Contents |
download here. We have all encountered decimal data errors at some time or another. The biggest difficulty they present is that, by the decimal-data error occurred in as400 time they have been detected, no recovery is possible. Or to be mch1202 error in as400 more precise, no practical recovery is possible. In my previous tip, I mentioned that one of the benefits decimal data error in as400 of data structure I/O is that you can avoid decimal data errors. In this tip I'm going to show you how and why that works. The code package associated decimal data error in cobol 400 with this tip contains three test programs that demonstrate the different scenarios. The first is a straightforward RPG program with no defenses. It reads a file in a loop and will encounter decimal data errors. The second is intended to show the basic use of DS I/O. It still has errors but they are subtly different. The third program demonstrates
Rpgle Monitor Decimal Data Error
how to extend the program to fully defend against such errors. See the Readme.txt file for instructions on how to install the source code on your system. One factor that adds to the difficulty of handling data decimal errors is that that they may occur on a READ or CHAIN operation, making it difficult to determine exactly which field is in error. This happens because the system detects the error while moving the data from the buffer to the internal variable. When we use DS I/O, the entire record is moved as if it were a large character field. In other words the numeric data is not differentiated. Since numeric fields are not differentiated they can't cause errors! Let's walk through the process of running each of the three programs so that you can see the differences between them. First, here are relevant portions of program DATAERRS1. FBadData IF E DISK DoU %EOF(BadData); Read BadData; If %EOF(BadData); Leave; EndIf; records += 1; total += amount; date = %Date(numDate: *YMD); EndDo; If you run this program, you will r
statements Oracle on iSeries File Sharing View All Integrated File System (IFS) iSeries Access (Client Access) iSeries managed email and groupware NetServer Network File System (NFS) QNTC File System
Rpg0907
High Availability View All Business Continuity High Availability Tools Replication IBM iSeries division news View All iSeries application development View All iSeries Application development tools iSeries CL programming iSeries COBOL programming iSeries ILE programming iSeries Java programming iSeries programming commands RPG iSeries programming Visual basic on iSeries iSeries backup and recovery View All Data backup, storage and http://www.itjungle.com/fhg/fhg031715-story01.html retrieval on iSeries iSeries disaster recovery and business continuity Remote Journaling Restores Storage iSeries database management View All DB2 UDB (universal databases) iSeries SQL commands and statements Oracle on iSeries iSeries document output View All Imaging on iSeries Printing on iSeries Printing-Imaging Tools iSeries hardware management View All Grid Computing Logical Partitions (LPAR) On-demand Computing iSeries networking View http://search400.techtarget.com/answer/What-is-a-Decimal-Data-Error All Connecting to Printers FTP Physical connections to iSeries Remote Access to iSeries TCP-IP VoIP iSeries security planning View All iSeries physical security iSeries system and application security Security Tools iSeries systems management View All Change Management Debugging i5-OS -- OS-400 iSeries Applications iSeries compliance and regulation iSeries service and support issues iSeries system performance and monitoring Multi-platform Integration Performance Server Consolidation Server Installation Server Pricing Systems Management Tools iSeries training and education View All iSeries job market iSeries skills User Groups iSeries upgrades and modernization View All Web Topics Archive View All iSeries Resources Please select a category File Sharing High Availability IBM iSeries division news iSeries application development iSeries backup and recovery iSeries database management iSeries document output iSeries hardware management iSeries networking iSeries security planning iSeries systems management iSeries training and education iSeries upgrades and modernization Section Evaluate News Get Started Evaluate Manage Problem Solve Sponsored Communities Q What is a Decimal Data Error? byJohn Blenkinsop One Search400.com member writes, "Can you please tell me what a Decimal
RECOVERY DB2 DOMINO HIGH AVAILABILITY LPAR NETWORKS PERFORMANCE PRINTING SECURITY SYSTEMS MANAGEMENT WEBSPHERE WINDOWS INTEGRATION GENERAL JAVA MODERNIZATION RPG WEBSPHERE CLOUD COMPUTING IBM ANNOUNCEMENTS IBM RESEARCH iTALK WITH TUOHY http://www.ibmsystemsmag.com/ibmi/developer/rpg/Ending-Those-Decimal-Data-Error-Blues/ LINUX OPEN SOURCE SOA WHAT'S NEW APPLICATION DEVELOPMENT MISCELLANEOUS SYSTEMS MANAGEMENT AUTOMATIVE BANKING/FINANCE http://www.mcpressonline.com/forum/forum/programming/rpg/12353-trapping-decimal-data-errors-on-a-read HEALTHCARE INSURANCE MANUFACTURING MISCELLANEOUS NON-PROFIT RETAIL DISK FLASH OPTICAL SERVERS TAPE PRODUCT REVIEWS IBM i > DEVELOPER > RPG Ending Those Decimal Data Error Blues July 2003 | by Jon Paris, Susan Gantner Print The OS/400 V5R2 version of the RPG compiler features many enhancements related to file I/O operations. data error We've found a useful way to leverage the fact that V5R2 allows you to specify a data structure (DS) as the result field of an I/O operation such as READ or UPDATE. Prior to V5R2, we could do this only for program-described files. (Remember those?) This new extension provides some interesting possibilities. For one thing, it can provide a performance benefit, especially decimal data error for batch jobs that process multiple records with many fields. Normally with RPG programs an I/O operation such as a READ requires the compiler to move each field individually from the file buffer to its storage location. You may have noticed this behavior when stepping though a program in debug. If you press F10 (step) on, say, a READ operation, the debugger "leaps" off to the I-specs and subsequent step operations work their way painfully through field after field-this behavior occurs even if all of the files fields are described in an externally described DS. However, using this new support, when a DS is specified as the result field, all of the fields are filled with a single move operation. This is more efficient than a series of individual moves. Another advantage of this support is that it provides more options for detecting and resolving invalid data items that may exist in our files. With a normal type of READ, if any data validity problems exist in the file (such as decimal data errors), the READ operation fails because each field is being "touched." When re
Forum Programming RPG Announcement Announcement Module Collapse No announcement yet. Trapping Decimal Data Errors on a Read Page Title Module Move Remove Collapse X Conversation Detail Module Collapse Posts Latest Activity Search Page of 1 Filter Time All Time Today Last Week Last Month Show All Discussions only Photos only Videos only Links only Polls only Filtered by: Clear All new posts B.Morris Senior Member Join Date: Oct 2016 Posts: 531 #1 Trapping Decimal Data Errors on a Read 01-08-2003, 09:56 AM S K Shipp wrote: > > I have a pgm that is crashing on a read operation if a decimal data error exists within one of the numeric fields on the file. Fair enough, I thought, I'll just trap the error when it happens and warn the user, rather than lose the program. Easier said than done though... > > I've tried using the %error BIF, defining a PSSR and generally tearing my hair out but none of these have helped at all. > > What should I be doing to handle this correctly? > Using (E) on READ and then %error won't help, since that only handles file-related errors. Using a PSSR should work although it would be awkward to get back to the next line after your READ ... oh, maybe that's what you mean about the PSSR not helping. If you are on V5R1, try MONITOR. c monitor c read file c on-error *file c some file-related error occurred c on-error c some other error occurred c endmon You can't get back from the on-error to your I specs to continue reading the rest of the fields, so you may have a case where your fields are partially updated with the new record. If you are on V5R2, you could read into a data structure and check the fields individually: fmyfile if e disk d myrecDS ds likerec(myrec:*input) /free read rec myrecDs; // now you can do any checking you want on myrecDs.fld1, myrecDs.fld2 etc. Tags: None Guest #2 01-08-2003, 10:18 AM Trapping Decimal Data Errors on a Read If you are just trying to read the record and then if there is a data decimal error to initialize the field or fields there is an old fashion way of handling it without any coding. The only problem is that the program must be RPG III and not IV (type RPG). On the original CRTRPGPGM command there is an option to ignore decimal data errors. This does work, even though IBM has always said unpredicted results may happen. In my experience the results are predictable, the field or fields are zeroed. I don't know if there is an equivalent in CRTRPGBND or CRTRPGMOD. If you are trying to fix the bad data you may want to consider a quick RPG pr