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


Please Help Members By Posting Answers For Below Questions

Explain mdt?

665


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.

5407


explain sflclr, sflend, sfldlt, and sflcsrrrn?

889


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.

2051


do you use message subfiles? What are the necessary keywords required coding a message subfile?

687






what is the difference between do while and do until?

703


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

548


what is the necessary keyword needed to scroll subfile records?

704


how can you display specific subfile page on the screen in unequal subfile?

675


how does the rpg element work?

716


What is the difference between iter and do?

676


how do I preserve and clean the array?

675


what is program status data structure?

1387


How can we override a file during runtime in rpg?

688


what is the rpg system?

668