SQL0305 indicate problem with null values in RPG program.
One of solution is to use SQL VALUE function to treat null values in SQL request
SQL0305 indicate problem with null values in RPG program.
One of solution is to use SQL VALUE function to treat null values in SQL request
ctl-opt ALWNULL(*USRCTL) ;
dcl-ds ASP_INFO qualified inz ;
ASPnum int(5) ;
TotCap int(20) ;
TotCapa int(20) ;
Threshold int(5) ;
ErrorLogSpc int(5) nullind ;
MachineLogSpc int(5) nullind ;
MachineTrcSpc int(5) nullind ;
MainDmpSpc int(5) nullind ;
MicrocodeSpc int(5) nullind ;
end-ds ;
exec sql declare ASPspace cursor for SELECT ASP_NUM, TOTCAP, TOTCAPA,
THRESHOLD, VALUE(ERROR_LOG_SPACE,0), VALUE(MACHINE_LOG_SPACE,0),
VALUE(MACHINE_TRACE_SPACE,0), VALUE(MAIN_STORAGE_DUMP_SPACE,0),
VALUE(MICROCODE_SPACE,0)
FROM QSYS2.ASP_INFO ORDER BY ASP_NUM DESC ;
exec sql open ASPspace ;
exec sql FETCH ASPspace INTO :ASP_info ;
VALUE(potencial_null_value,0) will replace null value with 0