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 |
WHAT IS MENT BY RECORD LEVEL IDENTIFIER ? WHAT IS THE PURPOSE OF THIS?
are there any useful c runtime apis that I can call from rpg iv?
Why we need to give File and To file Names While we are using OVRDBF. What is your understanding related to this?
i)What is the command to lock a file in a program ii)2. Can you get a level check error in a CL program
Can we have a Physical file without any member ? Please let me know
What is Multi Occurrence Data Structure(MODS)?
How Chain operation copies the record's data to the input buffer for the program?
Delete FileName at first statement in RPG.
what do you mean by an input subfile, what are the keywords required?
i hav 2 logical files(L1,L2) both r derived from one physical file(P1). how can i use both the logical files in one RPG program? if yes what i have to d.
2. Which of the following statement(s) explains the difference(s) between the /INCLUDE and ICOPY directives? a.) No difference, they function the same b.) ACOPY cannot be used as a conditional directive c.) IINCLUDE files cannot contain embedded SQL d.) Nesting /TNCLUDE directives is not allowed
What are the necessary keywords required to code a message subfile?