Hi,Can any body give the code for the below mentioned
quetion.?Im trying to get coding in with easily
inderstanding.Plese give me the coding for this?
1.How would you achieve this requirement with out using
RPG/RPGLE pgm,but by using only CL?Read a database file and
display file contents on the screen when enter key pressed
the next record should be displayed on screen.When the last
record is reached or when F3 key is pressed the program
should exit if the file is empty,a message should be
displayed indicate that there are no records to display.
Database file Name=EMPDBF
Fields in EMPDBF to be displayed on screen
Employee Number- EMPNUM(5,0)
Employee Name- EMPNAM(30,A)
Employee Address-EMP ADDR(50 A)




Hi,Can any body give the code for the below mentioned quetion.?Im trying to get coding in with eas..

Answer / Vandita Verma

Here's a CL example for reading a database file and displaying its contents using a loop. Note that this code does not cover error handling or optimization:nn DCL DBFILE(QCPYINF) TYPE(*LIBLIST)n DCL CURSOR(MYCURSOR)n DLTCURSOR(MYCURSOR) SZ(2048)n DCL FLD(EMPNUM FLDCOUNT(5) TYPE(*CHAR) LEN(5))n DCL FLD(EMPNAM FLDCOUNT(30) TYPE(*ALPHA) LEN(30))n DCL FLD(EMPADDR FLDCOUNT(50) TYPE(*ALPHA) LEN(50))nn CRTE DBFILE MYDBF FROMFILE("QCPYINF") REPLACE(*YES)nn OPNQ DBFILE(MYDBF) CURSOR(MYCURSOR) SQLRY(*FIRST)nn DO WHILE (% Found = *ON)n RDW MYCURSOR FLD(EMPNUM EMPNAM EMPADDR)n PRINT EMPNUM EMPNAM EMPADDRn SQLRY(*NEXT)n IF %Found = *ENDOFFILE THEN EXITn ENDDOnn DLTCURSOR MYCURSORn CLOSE DBFILE(MYDBF)n DEL FILE (MYDBF) RETURN

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More IBM AS400 AllOther Interview Questions

Q.How can more than two program be executed in batch mode through SBMJOB in CL PGM but the condition is that program must be executed one by one?Please wtite the senario? 2. IS it possibe more then two programs can be executed in batch mode and HOw it will be executed in CL program ,please write the senario?

6 Answers   IBM,


what are the limitations of cl (compare to rpg) ?

2 Answers   IBM,


if we tried to move year part of *iso date into a field of length 3, what will happen ?

1 Answers   IBM,


when is a tag statement used in rpg?

3 Answers   IBM,


What is the purpose of the "N" in the following calculation specification? C KEY CHAIN FILE N 99

1 Answers  


How to create an Access path in Synon/2E ?

1 Answers  


what is flatfile?what is the use of this file?where we can use usualy?what is the advantage of this?

2 Answers   Cognizant,


For AS/400 Freshers good website is

3 Answers   HCL, HP,


what is the main use of OPNQRYF ?? in that query why we can use OVERDBF and in that OVERDBY why should we use SHARE(*YES)

2 Answers   IBM,


What is the purpose of STRCMTCTL command?

1 Answers  


WHAT IS DECIMAL DATA ERROR IN RPG IV...WHEN WILL IT HAPPENS?

6 Answers   CTS,


how can you detect and handle a record lock situation?

2 Answers   IBM,


Categories