I'm having an issue with an SQLRPGLE program which must insert records in a table.
I've been debugging my program with strdbg command and I found out that the problem was caused by a packed decimal field called Mes in my data structure, when trying to insert that value into an integer field.
Source data structure definition (the first field in the DS is the field which hypotetically needs casting):
D DataDS DS QUALIFIED TEMPLATE
D Mes 6P 0
D Unidad 2P 0
D Subunidad 3P 0
D Grupopas 8P 0
D Productor 8P 0
D Asegurado 9P 0
. . .
. . .
. . .
The destination field is an integer.
P Exportar...
P B
D PI
D data DS LIKEDS(DataDS)
/free
ClrBI();
CLEAR data;
EXEC SQL DECLARE B1 CURSOR FOR
SELECT MES,UNIDAD, SUBUNIDAD, GRUPOPAS,
PRODUCTOR, ASEGURADO, RAMA, TIPO_MOVIM,
SUCURSAL,IFNULL(FACULTATIV,' '), CONDIC_IVA,
UNIDAD_FC, SUBUNID_FC, GRUPOPR_FC,
MATRICULA, CANALCOBRO, IFNULL(CANALCOBRX,' '),
PRIMACOB, PREMIOCOB, DEREMICOB,
RECADMCOB, RECFINCOB, IVACOB,
PER_IVACOB, ACR_IVACOB, ISSCOB,
INTERNOCOB, PER_IBRCOB, COMISICOBR,
COMISIAGEN,COMISIORGA,COMISIOTRS
COMISITOT
FROM BICOBRANZA
WHERE MES = :mes;
EXEC SQL OPEN B1;
EXEC SQL FETCH NEXT FROM B1 INTO :data;
DOW SQLCOD = 0;
SetBI(data);
CLEAR data;
EXEC SQL FETCH NEXT FROM B1 INTO :data;
ENDDO;
EXEC SQL CLOSE B1;
/end-free
P E
This is the first time I see an error like this. Does anyone faced this problem before? I don't know even where to start.
Thanks in advance.