1. How to retrieve RRN value in RPGLE program?

We can retrieve RRN value in RPGLE program by using INFDS

2. HOW TO DEBUG A BATCH JOB WHEN IT IS IN MESSAGEWAIT(MSWG) STATUS. I KNOW THE STEPS FOR BATCH EBUGGING, BUT IM CONFUSING WITH WHEN WE SUBMIT ANY JOB FOR BATCH DEBUG WE PUT IN HELD STATE. SO HERE ALSO DO SAME THING OR ANY OTHER WAY?

it is also normal process like as batch job steps...
when we found job in MSGW using WRKSBMJOB,simply we can enter into job log using 5 option.
after we start at command line.
step1-> STRSRVJOB jobnum/jobname/user
step2-> STRDBG pgmname
when we press enter,the control will directly goto
the error occurred line,here we can change any values directly using EVAL then after press F3,it will sho wjob log screen,then again press f3 to come to MSGW screen.here press 7(display message screen) to continue the execution of batch job we press G(continue).then it will execute remaing steps without abnormal ending the job.

4. What is difference between rename and prefix?

The RENAME keyword allows you to rename record formats in
an externally described file. The external name of the
record format that is to be renamed is entered as the
Ext_format parameter. The Int_format parameter is the name
of the record as it is used in the program. The external
name is replaced by this name in the program.

To rename all fields by adding a prefix, use the PREFIX
keyword.

6. Why we sometimes use same file name in FILE and TOFILE in OVRDBF and sometimes different?

In RPGLE if you want to declare the same file in more then
once mode(read/write/update)in this case you can override
the file with different name and declare the same file with
the overriden name.
for example:
In RPGLE if you want to open a file A in two different mode
one is Read and other is Update then you can override the
same file with two different name may be AA and AB and then
declare in your RPGLE program.

7. What are the commands that can be executed in CLP but not in RPG? Why?

All RTV* commands can be executed at CLP but cannot be
executed at RPG.

8. What is the difference between ITER and DO? We know both are used to execute set of statements repeatedly, but what is the main difference?

There is no comparison between DO and ITER as DO statement
is an looping statement and ITER is an branching statement
like LEAVE.
When I use ITER with some condition inside a DO-ENDDO loop,
when that condition occouerd, ITER transferred the control
to ENDDO not out of the loop like LEAVE ie it just skip the
execution of statements between ITER and ENDDO.

In one statement we can say that ITER in RPGLE is same as
CONTINUE in C.

9. Explain this error: "All Record Formats for externally-described file ABCD ignored or dropped due to error; file ignored."?

Actually the file ABCD may have the record format name is
same as that of the file name. That is the reason why u r
getting this error.
RPGLE wont allow to declare a file with same name as record
format name.
So, to solve the problam u can change the record format
name other than the file name.
OR
U can use the RENAME keyword in the file specification to
change the record format name.