rexxjunior
Programmer
Help ! I need to add up numbers in a mainframe PS file.
I get the value of the last number + the same last number (40 +40 = 80) instead of the total of all the numbers.
can anyone show me how to do this the correct way?
here is my code and the sample of the file I am reading
"EXECIO 0 DISKR INDD (OPEN"
EOF = 'NO'
DO WHILE EOF = 'NO'
"EXECIO 1 DISKR INDD (STEM LINE."
IF RC = 2 THEN
EOF = 'YES'
ELSE
DO
AMT = LINE.1
SAY AMT
IF AMT ¬= 0 THEN
DO
LINESUM = AMT + AMT
SAY LINESUM
END
END
END
"EXECIO 0 DISKR INDD (FINIS"
***********************************************
SAMPLE DATASET
15
805
1260
20
40
I get the value of the last number + the same last number (40 +40 = 80) instead of the total of all the numbers.
can anyone show me how to do this the correct way?
here is my code and the sample of the file I am reading
"EXECIO 0 DISKR INDD (OPEN"
EOF = 'NO'
DO WHILE EOF = 'NO'
"EXECIO 1 DISKR INDD (STEM LINE."
IF RC = 2 THEN
EOF = 'YES'
ELSE
DO
AMT = LINE.1
SAY AMT
IF AMT ¬= 0 THEN
DO
LINESUM = AMT + AMT
SAY LINESUM
END
END
END
"EXECIO 0 DISKR INDD (FINIS"
***********************************************
SAMPLE DATASET
15
805
1260
20
40