I am making a display file with a single selection list created by a single page subfile. With this implementation I found two problems.
The first one is that when I pressed Enter to select an option for the first time when the display file had been loaded, the READC operation in the RPGLE would return the correct value (it returns the character string in the subfile record). When I pressed Enter again with a different option selected, the value from the previous Enter press was returned. In subsequent turns it kept returning the value of the selection just before it. I added a second READC after the first one in the program just to see what would happen, and found out that both READC returned values. The first one returned the value from the previous selection, the second returned the value I had currently selected.
The second problem is that selecting the same option for multiple times did not work, i.e. it only worked for the first time and if I tried to select it again immediately it did not respond.
I had applied the same logic to another single selection list made of load all subfile and it did not have any of these problems. Does it mean that single page subfile is not suitable for making single selection list?
Here is the DDS for the subfile:
A R ITFMAT02
A S1OPTN 50 A 6 11
A R ITFMAT01
A SFLCLT(ITFMAT02)
A 27 SFLDSP
A 28 SFLCLR
A 29 SFLEND
A CF12(12)
A SFLSNGCHC(*AUTOSLT)
Here is the RPGLE main loop:
C *IN12 DOWEQ *OFF
C EXFMT ITFMAT01
C *IN12 IFEQ *ON
C LEAVE
C ENDIF
C READC ITFMAT02
C MOVEL S0OPTN W1OPTN
.
.
.
C ENDDO
Here is a working example. I suspect you haven’t been clearing the choice control field.
And the RPG. I don’t normally work in fixed format but tried to mirror the existing style.