1.Load an runtime array of length 99 from the pf and you
want to handle all the possible errors?
Answer / sagar wagh
H DFTACTGRP(*NO) ACTGRP(*NEW)
Dcl-F EMPPF DISK; // Declare the physical file
Dcl-S EmpArray CHAR(10) DIM(99); // Declare the runtime array
Dcl-S Index INT(10); // Declare an index for the array
Dcl-S ErrorMsg CHAR(100); // Declare a variable for error messages
// Main logic
C/EXEC SQL
C+ DECLARE C1 CURSOR FOR
C+ SELECT EMPNO FROM EMPPF
C/END-EXEC
C/EXEC SQL
C+ OPEN C1
C/END-EXEC
Index = 1;
DoU Index > 99;
C/EXEC SQL
C+ FETCH C1 INTO :EmpArray(Index)
C/END-EXEC
If SQLCOD = 100; // No more records
Leave;
ElseIf SQLCOD <> 0; // Handle SQL errors
ErrorMsg = 'SQL Error: ' + %Char(SQLCOD);
Dsply ErrorMsg;
Leave;
EndIf;
Index += 1;
EndDo;
C/EXEC SQL
C+ CLOSE C1
C/END-EXEC
| Is This Answer Correct ? | 1 Yes | 1 No |
what are the types of identifers
How we will read call stack?
what r drawbacks of OPM? Why do we go for ILE RPG?
why subproc not run in dftactgrp?????/plz explain
If record-format name in an externally-described file has already been defined as a file-name.how to solve this?
How to define data area in RPG program? In which scenario multi occurrence DS is use in AS400?
am 2010 passed out . can any one tell me which course is good to put 2+fake .guide me
RPG/400 faqs?
How to write record if no field or the field are different in physical file in rpgle ?
Interviewer asked me write down DDS for load all subfile .can anybody write dds
steps involved in debugging and types of debugging modes?
Why did we give STRSRVJOB while debugging batch program