Example: Use indicator variables in RPG/400® applications that use SQL

The following example shows declaring indicator variables in RPG.

Given the statement:

*...1....+....2....+....3....+....4....+....5....+....6....+....7...*
C/EXEC SQL FETCH CLS_CURSOR INTO :CLSCD,
C+                            :DAY :DAYIND,
C+                            :BGN :BGNIND,
C+                            :END :ENDIND
C/END-EXEC

variables can be declared as follows:

*...1....+....2....+....3....+....4....+....5....+....6....+....7...*
I            DS
I                                        1   7 CLSCD
I                                    B   8   90DAY
I                                    B  10  110DAYIND
I                                       12  19 BGN
I                                    B  20  210BGNIND
I                                       22  29 END
I                                    B  30  310ENDIND