I know chain keyword retreive records randomly but how chain
keyword exactly works internally????

Answers were Sorted based on User's Feedback



I know chain keyword retreive records randomly but how chain keyword exactly works internally????..

Answer / aditya

hello ,
see chain opcode locks the first record of pf and then
starts reading.it is useful when there are multiple
receivers present in your program and you want any specific
receiver.
it is always used with HIGH indicator.

Is This Answer Correct ?    5 Yes 0 No

I know chain keyword retreive records randomly but how chain keyword exactly works internally????..

Answer / drew

CHAIN:
positions current record to correct record based on key
sets HI indicator *ON if position fails and sets %found()
off in free-form code
reads the record fields into the automatic internal buffer
fields
locks the record, if in update mode and "no lock" has not
been added to the command ( chain(n))

Is This Answer Correct ?    1 Yes 0 No

I know chain keyword retreive records randomly but how chain keyword exactly works internally????..

Answer / sandy

chain op code firstly set the file pointer to BOF(begin of file).then look for key or rrn which is specified in factor 1.
in rpg400 EX:
 Factor1          opcode        factor2                    Key/rrn           chain       file name/record format name

Is This Answer Correct ?    1 Yes 0 No

I know chain keyword retreive records randomly but how chain keyword exactly works internally????..

Answer / nkumar

With chain High indicator is defined which will be set on if record is not found. Chain works exactly like SETLL and then READ record. If the record is found it will be read and indicator will be OFF and if record is not found then indicator will be ON.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More RPG400 Interview Questions

I want my simple Green screen should refersh every 1 min ,How can I do it..? Please share the logic

2 Answers  


1. I have2 records in a PF. READ PF DO DSPLY EMPNO RETRN DSPLY EMPNO ENDDO What was the output 2. SETON LR vs RETURN 3. Primary File 4. How to delete a deleted spaces 5. How to read a PF in reverse order in CL 6. I have a object in Lib A, B and C. But it shows in D Lib..Why? 7.

4 Answers   HCL,


what is *place and *auto keyword in prtf ?plz explain

0 Answers   CSC,


1.Load an runtime array of length 99 from the pf and you want to handle all the possible errors?

0 Answers   HCL,


Is it possible to call a subfile using CL. IF yes.. kindly help me out with explanation...?

3 Answers  






i have 6 char field in program, but this field is using in all files i want to chage field size as 10 char , how can i do this except using *like defn...?

1 Answers   IBM,


If my rpg program has a date field, what extra care I have to take while compiling that rpg program? If the file is keyed and I have declared the file as well as key list properly in my program. Still am getting an error message like "chain/reade operation is not allowed" what may be the case?

0 Answers  


What are the types of identifiers?

0 Answers  


HOW DO YOU DISPLAY A DISPLAYFILE AT OTHER WORKSTATION? CAN WE MOVE A PHYSICAL FILE? WITHOUT MOVING A FILE?

2 Answers  


what is the necessary command needed before OPNQRYF and why?

5 Answers  


How can we override a file during runtime in rpg?

0 Answers  


can you debug ile rpg program using isdb?

0 Answers   IBM,


Categories