Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


1.Load an runtime array of length 99 from the pf and you
want to handle all the possible errors?



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

Post New Answer

More RPG400 Interview Questions

what are the types of identifers

2 Answers   IBM,


How we will read call stack?

4 Answers  


what r drawbacks of OPM? Why do we go for ILE RPG?

1 Answers  


why subproc not run in dftactgrp?????/plz explain

2 Answers   CSC,


If record-format name in an externally-described file has already been defined as a file-name.how to solve this?

2 Answers   CTS,


How to define data area in RPG program? In which scenario multi occurrence DS is use in AS400?

0 Answers  


am 2010 passed out . can any one tell me which course is good to put 2+fake .guide me

1 Answers  


RPG/400 faqs?

1 Answers   HSBC,


How to write record if no field or the field are different in physical file in rpgle ?

0 Answers  


Interviewer asked me write down DDS for load all subfile .can anybody write dds

0 Answers  


steps involved in debugging and types of debugging modes?

1 Answers  


Why did we give STRSRVJOB while debugging batch program

3 Answers   HBL Power Systems,


Categories