Can someone tell me how to add the values of a repeated item in RPG,consider I have the same employee record repeatedly in File with his allowance data,i want to sum up his allowance,then what should I do in RPG?
Asked
Active
Viewed 35 times
-1
-
1It depends... Will you use native I/O or SQL? You should know that this really isn't quite a "tutorial" site. – user2338816 Jan 07 '17 at 04:36
-
Thanks for reminding me about the site :P,am talking about RPG here not SQl – PRITHISH SEN Jan 09 '17 at 04:49
-
Let's try to get this on topic. Edit the question with answers to: What have you tried? What happened? What languages do you know? – jmarkmurphy Jan 10 '17 at 13:44
1 Answers
0
if the file you are reading is Keyed by employee # or some such, you can load a "key". RPG400 looks like ....
Move *OFF *IN30
key SETLL Filename
*IN30 DOWEQ *OFF
KEY READE Filename *IN30
*IN30 *IFEQ *ON
LEAVE
ENDIF
"add your tot to a running accum"
ENDDO

Harley G.
- 64
- 6