Are zeros allowed in RPG programming?

Our RPG programmer told me that none of our AS400-based DB2 database tables can tolerate null values, since null values ​​in the RPG are "really hard to program." I would like to know if this is true, and if so, what makes this base database so difficult to use in an RPG?

I understand that this may be slightly outside the scope for, but it is the best source that I know for this kind of information.

+4
source share
2 answers

The answer turns out that "NULLS are allowed , but require additional work." User Carl Groner commented on this with a link to an excellent article that explains this from the perspective of an RPG programmer. Here is the relevant part that applies to my problem:

RPG / 400 does not support NULL processing in a database file. If the file contains NULL, pointing to the compiler's ALWNULL (* YES) option on the Create RPG Program (CRTRPGPGM) command allows the program to access the file only as input, with the proviso that all NULL-compatible fields contain a default value when it occurs NULL This means that the RPG / 400 program will not be able to distinguish NULL from, for example, a workpiece.

+1
source

IBM RPG , SQL- ISNULL:

exec sql declare X cursor for 
select ISNULL(numfield, 0), 
       ISNULL(alphafield, '')
from table
where field = value
for read only;
0

All Articles