Hi.can any body give me the code for this quesiton
please.Because i dont have to try to enter the code in to
the AS/400 server.Please can anybody give the answer for
this question with complete code?
A smple RPLE pgm which accepts the starting number and
ending number as parameter.It then has to count all the odd
numbers b/w the accepted range of numbers and display the
results/

Ex:if the input parameters are 11 and 30 the result should
be 10(11,13,15,17,19,21,23,25,27,29)

Please explain and give me the complete code?

Answer Posted / arun kumar

D Start S 3S 0
D End S 3S 0
D Count S 3 0
D Temp S 3 0
D Rslt S 3 0
D Rslt1 S 3 0
C *Entry PLIST
C PARM Start
C PARM End
/Free
Eval Temp = Start;
Eval Count = Start;
DoW Count <= End;
If %Rem(Temp:2) <> 0;
Rslt1 = Rslt1 + 1; //Number of ODD Numbers
Rslt = Rslt + Temp; //Sum of ODD Numbers
EndIf;
Temp = Temp + 1;
Count += 1;

EndDo;
Dsply Rslt1;
Dsply Rslt;
*InLR = *ON;
/End-Free
C** *InzSR BegSR
C** EndSR

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is the purpose of the indara keyword?

1102


What Does Lokup Does In Tables & Arrays?

716


what opcode will be used to test the zone of a character field?

1054


How can we read file using curser? how to define a curser?

816


how can you detect and handle a record lock situation?

1188






what are the basic features of seu?

601


how do you specify the number of records to roll in a subfile ?

1204


during input operation which indicator position is seton if there is a record lock?

913


what is the version of os/400 that we have?

936


what is rpg ?

921


A join logical file has how many record formats?

585


How can we update a specific field in RPG?

917


how do handle file exception/error?

637


how to read database records without locking them?

1108


which cl command is used to trap error messages during program execution?

850