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...

Thanks gagan for your answer,i'm new to as400,i don't know
embedded sql in rpg.can you send me the coding for the below
mentioned question in embedded sql rpg.
how to retrieve particular field records from a physical
file,say i have a physical file called 'employee' in it i
have to retrieve the records of a field 'admin' present in
pf 'employee' using rpg,but i should not use logical file
or openquery file.

Answer Posted / harshad r suryawaunshi

1. Declare cursor first - It will select all the record
available in the filed 'ADMIN'

c/exec sql
c+ declare cr1 cursor for
c+ select ADMIN from EMPLOYEE
c/end-exec

2. Open the cursor - its like seting the pointer on the
first record

c/exec sql
c+ open cr1
c/end-exec

3. Fetch the cursor - its like reading the records in the
cursor. NAME is the field defined in the program which
attributs are same as per field ADMIN.

c/exec sql
c+ fetch cr1 into :name
c/end-exec

This code u can execute in Do loop to read all the records.
The complete coding would look like this

c/exec sql
c+ fetch cr1 into :name
c/end-exec

C dow sqlcod <>100
C
C name dsply
c/exec sql
c+ fetch cr1 into :name
c/end-exec

C enddo

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

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

2466


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

2008


How to select highest score of each subject or how to select highest income of every month?

1759


what is program status data structure?

2396


How to handle duplicate error handling in RPG?

2295


We have job which is running as batch. It takes atleast 06 hours to complete tht job. But I wanna do tht job with in 3 hours?

1242


how do I declare a minor?

1156


1. If there are two programs using same file and 2 users are using the file at the same time and what can be done to allow them both to access? 2. How can remove lock from the file for accessing it by both users?

948


what is the use of sflnxtchg?

1256


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

1012


what are the key words you must use when using a subfile?

1175


How to call one program from another program in RPG? please help me with the code

1718


what is a rpg?

1188


How would display prime numbers using CL program?

6312


write an RPG program to calculate the marks of 5 students (A,B, C, D, E)in 3 different subjects (eng, math, sci) an display on the screen

1303