Don’t have direct answer to echoing many tiles to a file under qsh, but if your target is writing to a file in cl, do it with SQL, it’s easier!
something like this:
EXECUTESQL SQL('insert into mylib/mytable
select * from anotherlib/anothertable')
EXECUTESQL SQL('CREATE TABLE QTEMP/TENLIBS AS (
SELECT DIOBLI, DIOBNM, DIOBTP, DIOBAT, DIOBTX, DIOBSZ
FROM QUSRSYS/QAEZDISK WHERE DIOBTP = ''LIB''
FETCH FIRST 10 ROWS ONLY) WITH DATA')
You can find ExecuteSql here.
I’m not sure why you are trying to do this other than somebody said you could. A facility really shouldn’t be used if you haven’t learned how it works. The echo utility isn’t intended to output to database files.
Maybe you should examine this program:
crtpf RXTMP/RXTMP +
rcdlen( 80 )
addpfm RXTMP/RXTMP RXTMP
qsh cmd('echo "line 1" | Rfile -wQ ''rxtmp/rxtmp(rxtmp)''')
qsh cmd('echo "line 2" | Rfile -waQ ''rxtmp/rxtmp(rxtmp)''')
If you run it, try running this command afterward:
qsh cmd('echo "line 3" | Rfile -waQ ''rxtmp/rxtmp(rxtmp)''')
Note that it doesn’t matter if the sequence happens in a single program or if the QSH utilities are run later. Make sure you know what all is in the RXTMP file, and then run:
qsh cmd('echo "line 4" | Rfile -wQ ''rxtmp/rxtmp(rxtmp)''')
Review the purpose of the Rfile utility before actually trying to use it in programs.