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

Can you copy the records created by the OPNQRYF to other files and how?

2 Answers  


What is significance of a file designated as a Primary file in Rpg400 program....also what's use of secoundry file

1 Answers  


what is flat file?

1 Answers   IBM,


what is an online rpg?

0 Answers   IBM,


What is the name of default out queue when user logs inn to syatem with valid profile?

3 Answers   IBM,


Errors in Sql query will be in which state?

1 Answers  


I want to add 10 days in current date. how it is possible in CL program...?

11 Answers   CSC,


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

0 Answers  


Have a join logical file with more than one members with different record formats. So how can we read the different members from this file and also how we can read the different record format from the join logical?

3 Answers  


What is difference between bind by copy and bind by reference?

0 Answers  


how to find whether a date format is valid or not in RPG400 not in RPGILE.Can you please write the coding for this sir,i'm new to AS400.Please help.

2 Answers   iGate,


Suppose we add one field in physical file and this physical file is used by several programs.how do we know which program is using that file? What are the impact analysis.

6 Answers  


Categories