I'm working on an sqlrpgle program, when I run, I get the message: Decimal-data error occurred (C G D F)
**FREE
//******************************************************************/
//Program: States
// Written by: Victor Hernandez
// Date: 1/24/2024
// Purpose: This program Is a lab that demonstrates embedded SQL by reading
// the currency file in FLIGHT2023
// ***************************************************************/
//--------------------------------Control Options
ctl-opt Option(*NODEBUGIO) DFTACTGRP(*NO);
//--------------------------------Declare Files
dcl-f STATES Printer usage(*Output) oflind(EndOfPage);
//--------------------------------Constants
dcl-c EndOfFile '02000';
//--------------------------------Stand Alone Variables
dcl-s EndOfPage Ind Inz(*on);
dcl-ds ZIPDS Extname('ZIPPF') end-ds;
//--------------------------------Main
EXEC SQL DECLARE cur CURSOR FOR
SELECT * FROM ZIPPF
FOR read only;
EXEC SQL OPEN cur;
dou SQLSTATE = EndOfFile;
EXEC SQL FETCH cur INTO :ZIP, :CITY, :STATE;
Exsr Overflow;
WRITE DETAILS;
ENDDO;
EXEC SQL CLOSE cur;
*INLR = *ON;
RETURN;
BEGSR OVERFLOW;
IF ENDOFPAGE;
WRITE HEADER;
ENDOFPAGE =*OFF;
ENDIF;
ENDSR;
I tried to hit prompt on the CRTSQLRPGI command to see if I could change something but didn't find a way to ignore decimal data errors. The print file shows the headers in an absolute record, but the data, which is in a relative record, does not show up
It's not a good idea to ignore decimal data errors, so there's no option to do that. Instead, you should figure out what is causing the error and fix it.
If you run your program in debug, it will stop on the statement that gets the error, and then you can inspect the variables used on that statement. For packed and zoned variables, look at the values in hex to see which variable is incorrect. Packed variables should have the hex form x'nnnnnF' or x'nnnnnD' where n is 0-9, for example x'12345F'. Zoned variables should have the hex form x'FnFnFnFn' or x'FnFnFnDn', for example x'F1F2F3F4F5'.