Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...


Write a program to display prime numbers between 1 to 100 using RPGLE.



Write a program to display prime numbers between 1 to 100 using RPGLE...

Answer / saravanan3

D N S 2P 0 INZ 0
D Q S 2P 0
D R S 2P 0
D I S 2P 0

C PARM N
MOVE 2 I
DOU I >= N
I DIV N Q
MVR R
IF R=0
“Number is not PRIME” DSPLY
ENDIF
ADD 1 I
ENDDO
IF N=I
THEN
“Number is PRIME” DSPLY
ENDIF
C SETON LR

Is This Answer Correct ?    3 Yes 2 No

Post New Answer

More RPG400 Interview Questions

i)What is the command to lock a file in a program ii)2. Can you get a level check error in a CL program

6 Answers  


How can a screen field that has changed since the last output operation be detected?

4 Answers   IBM,


purpose of pannel group??/

2 Answers   CTS,


What is SFLNXTCHG keyword why it has used and where? Briefly explain with Example.

2 Answers   IBM,


How can i check the object existance in RPG program without using QCMDEXC command.

7 Answers   IBM, JDA,






Anybody can explain the difference between SFLCLR & SFLINZ?

7 Answers  


explain sflclr, sflend, sfldlt, and sflcsrrrn?

0 Answers   IBM,


what is batch debug in as400?

3 Answers  


Q:HI friends accually ihave one problem plesase let me know the alternate code of this code. Related field description of code: Add a field, CALvsPRD, "Calendar Day Starts Before/After Production Day" to the parameter set WRKORDER which accepts values 'A' or 'B' o B = Calendar Day Starts Before Production Day o A = Calendar Day Starts After Production Day o Any other value indicates the production and calendar dates are always the same. code: Automatic Execution Of *INZSR Subroutine /Z01 * retrieves WRKORDER field values. /Z01 * Calculate default Production Date and return it to caller. /Z01 * Production date defaults to system date /Z01 C Eval P@Pdate = %DATE() /Z01 * unless Calendar date starts Before PDN(production) date and /Z01 * system time is before PDN Start Time then /Z01 * PDN date is yesterday. /Z01 C If W@CALvsPRD = 'B' and /Z01 C %TIME() < %TIME (W@Strtime) /Z01 C Eval P@Pdate -= %Day(1) /Z01 * unless Calendar date starts After PDN date and /Z01 * system time is *GE PDN(production) Start Time then /Z01 * PDN date is tomorrow. /Z01 C ElseIf W@CALvsPRD = 'A' and W@Strtime > *Zero and /Z01 C %TIME() >= %TIME (W@STrtime) /Z01 C Eval P@Pdate += %Day(1) /Z01 C EndIf /Z01 C Eval *InLr = *On

0 Answers   IBM,


How do u design a physical file, when you have 2 Unique fields like for eg in A student file student ID and student examination no both are unique

0 Answers  


I have a PF(ABC)with no key fields. PF(ABC)have 2 fields (cusno and cusname). Please let me know how can i read the cusno = 1150 directly from PF in CL and RPG program(Without creating the LF and without reading the complete file and then compare 1150)

3 Answers   Opus,


1.I have a Physical file with 100 records, No duplicates exists, all are Unique,But while i am running Runqry utility i am getting only 80 records..What could be the reason?

3 Answers   Cap Gemini,






Categories