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?

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

what was the robotech rpg?

1189


what do you mean by an input subfile, what are the keywords required?

1243


explain sflclr, sflend, sfldlt, and sflcsrrrn?

1338


How can we know running job is batch or interactive?

1106


what is an online rpg?

1249


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

1706


How do u design a physical file, when you have 2 Unique fields like for eg in A student file student ID and student examination no both are unique

1003


what is the rpg system?

1261


What are the types of identifiers?

1009


How many program bind in one module....

2656


How to create a login screen using a command instead of display file.... intention is to get a password field on a command..... how do you achieve this...

1865


When we have a file with Duplicate records and I want to read the unique record from the file. For example a file containing Emp Name as 'Ram' and there are 3 entries of it. So how to read a unique record from File?

939


What is ment by record level identifier?

1131


Program to read marks of 10 students for 4 subjects and compute and display total marks and status of each student in rpg

1125


what is the difference between do while and do until?

1233