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.
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / ravi
Give DOW SQLCOD =0. There are several other errors with SQLCOD <> 0
| Is This Answer Correct ? | 0 Yes | 0 No |
Anybody know the difference of primary file and full procedural file
Mr.Yallamanda Reddy P thanks for your answer sir,can we use test(D) opcode in RPG/400,if yes please help me by eloborating on that answer by writing a sample code for that sir
HI,1: What is the function of 'SETON LR' AND '*INLR=*ON ? 2:Can we used "seton lr" OR "*INLR = *ON" in between the program code ? 3:if yes then according to there function the code which is written acter seton lr/ *inlr should not be execute . Can any one tell me why those code get executed ?
difference between CHAIN and READE?
Need a sql query: retrive all duplicate records in table
In how many ways a session/device error occurs,,, and what is the remedy for it?
how we retrieve records without using key field (ex:name) from Physical File through RPG in as/400?
i want to perform uniqness on db file bt my db file nt hving key by useing rpgle.
Assume 2 users are using the same file and first user updates some record in the file. Will the 2nd user will be able to see the updated record or not?
How to update selected fields from pf without using update opcode. How to read all member in Rpg-3,without using any cl command?
how many variables can we declare in cl pgm?
Delete FileName at first statement in RPG.