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)
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 |
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?
what are the limitations of cl (compare to rpg) ?
if we tried to move year part of *iso date into a field of length 3, what will happen ?
when is a tag statement used in rpg?
What is the purpose of the "N" in the following calculation specification? C KEY CHAIN FILE N 99
How to create an Access path in Synon/2E ?
what is flatfile?what is the use of this file?where we can use usualy?what is the advantage of this?
For AS/400 Freshers good website is
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)
What is the purpose of STRCMTCTL command?
WHAT IS DECIMAL DATA ERROR IN RPG IV...WHEN WILL IT HAPPENS?
how can you detect and handle a record lock situation?