On Mon, Nov 16, 2015 at 4:39 PM Steinmetz, Paul <PSteinmetz@xxxxxxxxxx>
Qsh cat worked.
I'm surprised that IBM does not have an i5/OS command for this?
Because a stream file isn't what you probably think it is. Or maybe
because my concept of what a physical file isn't what it really is.
My first question is what does this IFS file look like?
A steam file is just a stream of bytes. Since your talking about records I
assume its a CSV in this instance or a tab delimited file or something.
However, there is no intrinsic concept of record in a steam file. There is
probably either a carriage return carriage return and line feed symbol
delimiting different records in that file. However, records don't have any
maximum length, and nothing in the OS or PASE cares about newlines or knows
how many "records" are in the file without reading all the bytes and noting
how many newlines there are.
As a matter of fact, if I decided to encode the data in json or XML format,
I could do it without any newlines.
So honestly, if I was IBM and was going to make commands to do this from
the green screen I'd have an API call that parsed a delimited string of
text (remeber strings can have newlines, records aren't special) and put it
in a temporary table in QTEMP. Then I'd make a stored procedure and CL
command to interfect with that in a normal fashion. Then I'd have an API,
stored procedre and CL comand to do the opposite, go from a table, view or
select statement to a string. There would be optional parameters to put
that string to a variable or an IFS steam or whatever.
Then if I wanted to append records, I'd load both IFS stream files into
teporary tables, SELECT them together with a UNION and put that in the IFS
It SEEMS like the green screen answer would involve CPYTOIMPF or you could
try this third party tool
. However, I'm a
seasoned unix guy whose very comfortable with SQL and quickly iffy on the
green screen side of things. I recently ran into a PF with what appeared
from SQL to have one field with all the data in it. My boss gave me a bunch
of commands to go looking to see if there were logical files associated
with it. You probably know exactly what those commands are. However, I
find those just as weird as cat and redirecting seems to you.
As an Amazon Associate we earn from qualifying purchases.