Handle Decimal Data Error Rpg
Contents |
This document provides information about finding and correcting decimal data errors. Resolving the problem It is not uncommon for programs to have problems with decimal data errors when working with files that originated on mainframes, non-IBM systems, and decimal-data error occurred in as400 the IBM System/36. Program-described files are normally used on these systems and can result in
Mch1202 Error In As400
non-numeric hexadecimal values in numeric fields. It is also possible for a program on the IBM OS/400 or IBM i5/OS system to decimal data error in as400 do this because program-described files are still available, especially for programs that have been migrated and are running in the System/36 environment. The following example takes advantage of the field descriptions in externally-described files to correct the
Decimal Data Error In Cobol 400
problem. The program reads in each record and writes it out making assumptions on what the correct value should be. You are responsible for evaluating the results of using this program. Because it is necessary to make assumptions, the results might not be what you require. However, there is a very good chance the results will be satisfactory. Always keep a back-up copy of the file until you evaluate the results and are comfortable with rpgle monitor decimal data error the end result. In the case of zoned numeric fields, hexadecimal values such as blanks, control characters, and unassigned hexadecimal values are normally converted to zeroes. When letters or special characters (for example, the ampersand) are encountered, the first hexadecimal character is converted to an F. For example, the letter A is C1 in hex, while the letter a is 81 in hex. Both are converted to F1, which is the number one. In testing, 8aA69 is converted to 81169. However, when certain values are encountered in certain positions in the field, the entire field can be converted to a zero value. For packed numeric fields, an incorrect value in any position normally causes the entire field to be converted to a zero value. One exception was noted in testing. A 10-digit packed field requires a 6-byte field, and the first position of the first byte is not used. An incorrect value in that first position still produced a correct converted value. All other testing resulted in a zero value being produced. To create and run the program to correct your data, you should do the following: 1. Make a copy of the file so you can examine the resulting changes. To avoid accidentally updating the production copy, use a different name for the copy. For example, if the original name is O
out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. sponsored links Collapse Announcement Collapse No announcement yet. How to get rid of decimal data error when RPGLE program submitted in a job. Collapse X 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 Previous Next ris_skma Experienced Forum http://www-01.ibm.com/support/docview.wss?uid=nas8N1018444 Member Join Date: Apr 2005 Posts: 120 #1 How to get rid of decimal data error when RPGLE program submitted in a job. March 23rd, 2010, 06:59 AM I have a RPGLE program (PGMR1) which is being called in a batch Job (JOB1). The RPGLE reads all records from an input file INPF1 (having 5 fields – INF1 – INF5 – all character fields) and writes to an output file (having 5 http://www.code400.com/forum/forum/iseries-programming-languages/rpg-rpgle/9222-how-to-get-rid-of-decimal-data-error-when-rpgle-program-submitted-in-a-job fields – INF1 – INF5 – all numeric fields) depending on some conditions. I am moving the input file character data to output file numeric data. Now if any of the input file field contains junk value then the RPGLE program fails and the job goes to message wait. My question is as a support team member how can I handle this job (without killing it) so that it ignores the erroneous record and processes all other records properly?? Thanks in Advance.... Tags: None Billw SubAdmin Join Date: Sep 2005 Posts: 863 #2 March 23rd, 2010, 08:11 AM Re: How to get rid of decimal data error when RPGLE program submitted in a job. Monitor for the unvalid data and take the appropriate action. If you wish to ingore the field and process the rest of the fields: Monitor Eval NumOut1 = %Dec(NumInput1:5:0) // Length is 5,0 On-Error Eval NumOut1 = *Zero Endmon Or if you wish to ignore the record: Monitor Eval NumOut1 = %Dec(NumInput1:5:0) // Length is 5,0 Eval NumOut2 = %Dec(NumInput2:5:0) // Length is 5,0 Eval NumOut3 = %Dec(NumInput3:5:0) // Length is 5,0 Eval NumOut4 = %Dec(NumInput4:5:0) // Length is 5,0 Eval NumOut5 = %Dec(NumInpu5:5:0) // Length is 5,0 Write NewRecord On-Error // do nothing if error occured Endmon Last edited by
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 LINUX OPEN SOURCE SOA WHAT'S NEW APPLICATION DEVELOPMENT MISCELLANEOUS SYSTEMS MANAGEMENT AUTOMATIVE BANKING/FINANCE HEALTHCARE INSURANCE MANUFACTURING http://www.ibmsystemsmag.com/ibmi/developer/rpg/Ending-Those-Decimal-Data-Error-Blues/ 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 http://www.allinterview.com/showanswers/98267/what-is-decimal-data-error-in-rpg-iv-when-will-it-happens.html features many enhancements related to file I/O operations. 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 data error 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 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 decimal data error 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 reading into a DS, the individual fields arent touched during the READ operation, hence no error. As soon as the program tries to use the field containing the invalid data, you still get a decimal data error, so how is this useful? Suppose that we were to combine this new I/O support with the MONITOR operation that was added at V5R1 (see "RPG MONITOR is a Flexible Facility"). Now we have an effective method to detect and add program logic to report and potentially fix those errors. Let's examine an example. Suppose MyFile contains three nu
AS400 >> IBM AS400 AllOther Suggest New Category WHAT IS DECIMAL DATA ERROR IN RPG IV...WHEN WILL IT HAPPENS? Question Posted / ddd 6 Answers 15907 Views CTS, I also Faced E-Mail Answers Answers were Sorted based on User's Feedback Answer / narendra If you have defined any field as numeric and the value being inserted into that field is character then system will throw the message "decimal data error". Is This Answer Correct ? 27 Yes 5 No Answer / madhusudhan For the above answer posted by Narendra, there are 19 People who told yes, but did they test this or verify. Create a Char variable of Lenth 5 and Numeric variable of lenth 5 and see the result . D Num1 S 5 P 0 D Char1 S 5 A INZ('ABCDE') C MOVE Char1 Num1 C Num1 DSPLY Num1 will not give a Decimal Data error , instead it gives the values Num1 = 12345. If you use eval C EVAL Num1 = Char1 Eval will fail during compilation itself. As per my analysis , Decimal Data error occurs when junk values or special characters are passed to Numeric variable. ( Ex : !, @ , #.$) . For testing Intialize the above variable Char1 with atleast one special character and just see the result. This is only one example which i have given , and i heard that during Parameter passing also this occurs , but dont know in which scenerio , if anyone knows more on Decimal Data error, kindly plz post. Is This Answer Correct ? 18 Yes 0 No Answer / priya Decimal data error occurs primarily when numeric field receives invalid values/numbers. The same goes for the case of parameter passing. When the file is opened by a program and the record containing the invalid data is read, you will not get an error. But if the field containing the invalid data is read in the program, and some arithematic operation is performed with that value it gives decimal data error. For eg by being the Factor1 of a MOVEx operation, or either factor in an ADD, SUB, DIV, MULT etc., or on the right-hand side of an EVAL, or if it is involved in a WRITE or UPDATE operation -- then it will be checked, and then the program will fail. Is This Answer Correct ? 3 Yes 0 No Answer / venkat suppose if i declare data area with the length of 8 char and i am receiving that data area as data structure and if i give only 7 char value. if i compile the program program will compile but if you call that program it will throw the error as decimal data error Is This Answer Correct ? 2 Yes 0 No Answ