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

what is the use of sflnxtchg?

812


can anybody help me to solve this problem. the program that i m checking display error message saying "Record format for file AJDSPFFD does not match model file and decimal error. how to solve this problem. The AJDSPFFD is snapshot the AJTLOG that is the audit trail list.

2285


can I touch the array during treatments?

764


How to declare the pull button in AS/400..

1888


What is ment by record level identifier?

663






how do you use commitment control in rpg?

764


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

1741


if there is a module object , how to find the program object for this module object.Assume the module object name and program object name is not same.

2205


what is the procedure and explain about real time scenario.

1488


during execution, an rpg/400 program automatically follows a sequence of operations for each record that is processed. The built-in program cycle includes the following logical steps.

762


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

696


give an eg of ACQ-(ACQUIRE),BIT OFF,BIT ON,DEALLOC,DUMP,FEOD,FORCE,MHHZO,MHLZO,MHLLZO,MLHZO,REL,RESET,TESTZ,TESTB,TESTN----GIVE SMALL EXAMPLE TO THE OPCODES...TO UNDERSTAND FUNCTIONING...........

3296


which program rpg or cl is efficent to update a transaction onto a database file and why ?

751


how can I tell when to replace the array?

708


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?

501