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 do you mean by SESSION/DEVOCE ERROR?
wat is the difference between array and multiple occurence data structure?
How to print output from openquery in as400 ?
What are the types of identifiers?
When will DUMP & DEBUG be ignored?
How would display prime numbers using CL program?
1.How you will find the program is batch or online in cl pgm? 2.How you will end the batch pgm when the job runs? write an logic? 3.In wich command the option *drop is used?
How to declare the dynamic(run time) array in rpgle? can you please give example
while i am using the dspmsg command on comman line in Mocha am getting error like Not authorized to message queue message my messagequeue Name? can anybody help me how to change my message queue Am anable to see my messages in message queue
How to declare the pull button in AS/400..
steps for debugging two rpg programs????
in which journalling which attributes are necessary