Ok, I'm converting a program flow written in RPG using COMP opcode into RPGIV. Code is below:
The confusing part for me is the lines of code that uses COMPARE. The way I understand is that this is what will happen.
1) If VAR1 and VAR2 are not equal, *IN27 is *ON.
2) The second compare of VAR3 will be processed if *IN27 is *ON. If VAR3 is equal to '0', *IN27 = *ON. Otherwise, *IN27 = *OFF.
3) If *IN27 = *ON, VAR4 is compared to 'D'. If VAR4 = 'D', *IN27 is switched *OFF. Another round of READE is done and VAR4 checking is skipped.
If my assumptions are correct, I plan to convert the logic into the following:
Any feedback is greatly appreciated. Thanks!
Code:
KEY CHAIN FILEA 10
*IN10 DOWNE '1'
VAR1 COMP VAR2 2727
27VAR3 COMP '0' 27
27VAR4 COMP 'D' 2727
N27KEY READE FILEA 10
N27 ENDDO
1) If VAR1 and VAR2 are not equal, *IN27 is *ON.
2) The second compare of VAR3 will be processed if *IN27 is *ON. If VAR3 is equal to '0', *IN27 = *ON. Otherwise, *IN27 = *OFF.
3) If *IN27 = *ON, VAR4 is compared to 'D'. If VAR4 = 'D', *IN27 is switched *OFF. Another round of READE is done and VAR4 checking is skipped.
If my assumptions are correct, I plan to convert the logic into the following:
Code:
KEY CHAIN FILEA DoW Not %EoF(FILEA) If VAR1 <> VAR2 If VAR3 = 0 and VAR4 <> 'D' ...several more statements EndIf EndIf KEY ReadE FILEA Enddo






Comment