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 / arijit

Please try the below code:

D @StartNum S 3S 0
D @EndNum S 3S 0
D #Counter S 3S 0
D #LoopCnt S 3S 0
D #Result S 50A
*
C *Entry Plist
C Parm @StartNum
C Parm @EndNum
*
C Eval #Result = '('
C Eval #LoopCnt = @StartNum
C Eval #Counter = 0
*
C DoW #LoopCnt < @EndNum
C If %REM(#loopCnt:2) =
1
C Eval #Result = %TRIM(#Result)
+
C %TRIM(%CHAR
(#LoopCnt)) + ','
C Eval #Counter = #Counter +
1
C
ENDIF

*

C Eval #LoopCnt = #LoopCnt +
1
C
EndDo

*

C Eval %SUBST(#Result:%Len(%Trim
(#Result)):1) = ' '
C Eval #Result = %CHAR(#Counter)+%
TRIM(#Result)+')'

*

C #Result
Dsply
C EVAL *InLr =
*On

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

the maximum number of subfiles that can be active for a single file is ____ .

1169


how to read database records without locking them?

1116


What Is The Difference Between Goto & Exsr?

1164


what is the sequence when using cursor?

595


Difference between NOPASS & OMIT?

1180






what is the use of data structures?

627


what is the purpose of indicators in rpg?

1060


what is the purpose of putovr (put with explicit override) keyword?

916


how can I give more performance to some selected pages?

606


what does check opcode do ?

1050


Difference Between Call & Sbmjob?

764


what is a spool file?

662


define subsystem?

1013


what is full form for dds?

728


what are the different methods to access seu?

615