how we retrieve records without using key field (ex:name)
from Physical File through RPG in as/400?
Answer Posted / syam
Yes, You can retrieve records from External Physical File
with key.
1.Specify PF as a program described file in RPG Program.
FFilNam IF F 80 6AIDISK KEYLOC(7)
(80=Record Lenght, 6=Key Lenght, (7)=Key starting
position)
2. IFilNam KD 01 1 C0 2 C1
I 7 12 NAME
(KD=Sequence,01=Record Id,1&2=Starting position,C=Any
Character,0=Value. Means In my file each record is having 1
and 2 posion = 01 to identify record, 7 to 12 =Name)
3.C MOVE 'SYAM' NAME
C 'SYAM' CHAIN FilNam
C N41 MOVEL NAME CUSNME
C 41 MOVEL *BLANK CUSNME
Try this code.
Is This Answer Correct ? | 4 Yes | 10 No |
Post New Answer View All Answers
Explain mdt?
1. What is bound-by-call and bound-by-reference? 2. Where and why is *Nomain used? 3. What are the difficulties faced by programmers when using service programs? 4. Explain the different ways of parsing and compiling XML in iSeries.
explain sflclr, sflend, sfldlt, and sflcsrrrn?
Please tell me how to read the records from a file with load an array of size with error conditions(The logic answer for this question is ARR is array of 99 elements Z-ADD 0 IDX *LOVAL SETLL FILE READ FILE 99 *IN99 DOWEQ *OFF IDX ANDLT 99 ADD 1 IDX MOVE FIELD ARR,IDX READ FILE 99 ENDDO).So,Please give me the complete of this code.
do you use message subfiles? What are the necessary keywords required coding a message subfile?
what is the difference between do while and do until?
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
what is the necessary keyword needed to scroll subfile records?
how can you display specific subfile page on the screen in unequal subfile?
how does the rpg element work?
What is the difference between iter and do?
how do I preserve and clean the array?
what is program status data structure?
How can we override a file during runtime in rpg?
what is the rpg system?