how we retrieve records without using key field (ex:name)
from Physical File through RPG in as/400?

Answers were Sorted based on User's Feedback



how we retrieve records without using key field (ex:name) from Physical File through RPG in as/400?..

Answer / kumar vikas

Ffile1 I F E DISK (no keyfield is given)
C
C *start setll file1
OR
C 1 setll file1
C
C read file1
C dow not %eof
C id dsply
C name dsply
C read file1
C enddo

Is This Answer Correct ?    15 Yes 1 No

how we retrieve records without using key field (ex:name) from Physical File through RPG in as/400?..

Answer / ttom

Read the file till EOF and check field values using a
condition in a the loop.

Is This Answer Correct ?    3 Yes 2 No

how we retrieve records without using key field (ex:name) from Physical File through RPG in as/400?..

Answer / anand

but atleast there should be a keyfield to perform setll right ?

Is This Answer Correct ?    5 Yes 5 No

how we retrieve records without using key field (ex:name) from Physical File through RPG in as/400?..

Answer / sujit kumar biswal.

Witout key u can use either SETGT or SETLL.And witought key
these two opcodes work only folloing conditions.
1.U can spesify any sequence no in factor1
2.Also *hival is work with it.
3.Field name work but only for intiger.

so code ur programe as answer4,but just change the *loval
to any sequence no or *hival then readp or any int field
one ex.
F PF/LFNAME IF E DISK

C *HIVAL SETLL RECORDFORMATNAME/PROG.NAME
C DOW %EOF
C READP RECORDFORMATNAME/PROG.NAME
C FIELDNAME1 DSPLY
C FIELDNAME DSPLY
C ENDDO
C EVAL *INLR=*ON

Is This Answer Correct ?    0 Yes 0 No

how we retrieve records without using key field (ex:name) from Physical File through RPG in as/400?..

Answer / ak

use chain and put factr1=rrn number (line number)
and u hit the dirct

Is This Answer Correct ?    1 Yes 1 No

how we retrieve records without using key field (ex:name) from Physical File through RPG in as/400?..

Answer / gk

We can read the records from the file directly without any
key field.

*LOVAL SETLL XXXX
READ XXXX
Put it in the DO loop and check for the EOF.

Hope you have got the answer.

Is This Answer Correct ?    9 Yes 11 No

how we retrieve records without using key field (ex:name) from Physical File through RPG in as/400?..

Answer / ld123q44

The question is how you retrieve records from externally
defined files without using a key.

You can do this by designating the file as a primary file in
the program.

Is This Answer Correct ?    0 Yes 4 No

how we retrieve records without using key field (ex:name) from Physical File through RPG in as/400?..

Answer / 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

More RPG400 Interview Questions

Why we cannot call a service program? If I add a PEP can i call the service program?

1 Answers   DELL,


How to select highest score of each subject or how to select highest income of every month?

0 Answers  


how can i retrieve the field name from display file at run time? Devendra Singh Tomar

3 Answers  


what is plat file?

6 Answers   Indian Infotech,


If there are 1000 member(PGM type) in a SRC file. How can we compile in a CL program? ( It need to be done in a loop)?

1 Answers  


1.WHAT IS WRONG WITH THE CODE BELOW? C CUSTNO CHAIN CUSTMAST IF %ERROR can any body find the wrong please? 2.What builtin function will you use to achieve the following functionality? C QTY IFLT *ZERO C QTY MULT-1 QTY ENDIF

5 Answers   CTS,


1.I have a Physical file with 100 records, No duplicates exists, all are Unique,But while i am running Runqry utility i am getting only 80 records..What could be the reason?

3 Answers   Cap Gemini,


what is commitment control?explain about it?

1 Answers   HSBC,


1. Which Built-In-Function will you use to achieve the following functionality? CLONO1NO2NO3 Factorl÷÷+OpcdeFactor2++÷ResultLenDHHiLoEq C QTY IFLT *ZERO C QTY MULT -1 QTY C ENDIF a) %ABS b) %TRIM c) %TRIMS d) %UNS

3 Answers   IBM,


how do you use commitment control in rpg?

0 Answers   IBM,


how to check on which PF , the LF is dependant ?

4 Answers   IBM,


this is rpg3 code W0RTN IFEQ @CN,002 what is the means @CN,002

1 Answers  


Categories