I am not sure that I understand your objective but below is a simple set of code that reads though the combined file presenting every record,
If you want to read the records in the order they are sequenced then read from the file - the access path for file test has a single pointer -- not one for each record. So when you say that you want to read from test2 the file reads forward to the next record of the right record type. When you ask for the next record of any type it's from that point.
Ftestjoin if e k disk -> my LF, it has two PF(TESTA, TESTB) Froughdsp cf e workstn -> my display file C dow *in03=*off c exfmt tworead -> display file record format name C read testjoin C exfmt tworead C Do while not %EOF(testjoin) and not *in03 03 is screen exit key C read testjoin C exfmt tworead C Enddo C Eval *inlr = *on C Return
here we can’t change the order of record display. because
It’s taking all of the records in the two files and sorting (ascending or descending) them depend upon records on key fields….