On 30 October 2016 at 14:45, Booth Martin <booth@xxxxxxxxxxxx> wrote:
My memory says that the easiest way to transfer data from my PC to an
iSeries is to first download the empty target file down to my PC, save the
definition file, and then upload the data using that definition file.
Hi Booth, this is the RPG list, so I'm going to assume (hee hee) that
you want an RPG solution. I'm personally fond of sharing an IFS
directory. The end user maps a drive letter to that directory, and
can directly save her work there. From her perspective, she's done
File > Save As... From your perspective she's done the file transfer
:-)
The RPG part comes in where you read that file. If it's an XLSX, you
can use (again this is the RPG list) Scott Klement's HSSF/POI wrappers
to directly read the spreadsheet row by row, column by column.
Sanitise it, rationalise it, relationally integrify it :-) and plop
the result into a genuine DB2 table. Or you can use Scott's IFS APIs
to read a TXT file directly, and parse out the bits and pieces you
need before putting it into a DB2 table.
There's nothing /wrong/ with some sort of file transfer step whether
it be FTP, ACS file transfer, or something else entirely. Well,
nothing except that these utilities don't sanity check the file before
shoving it down the throat of some poor DB2 table. If the user added
another column to the spreadsheet, or typed in a name in the ZIP
column, or put dollar signs in the amount column, the naked 'transfer'
step is going to either go casters up or put whacko data into your
previously clean DB2 table.
In years past, I got around this by making a 'work' table that was a
bunch of ridiculously large character fields. No numerics whatsoever.
Then I had an RPG program that checked every column in every row to
make sure the data was at least sane enough to put into the 'real'
table. Convert all the character data to the proper DB2 format and
off I'd go. If I have to do that work anyway, why add another,
separate 'transfer' step to the user's workflow?
--buck
As an Amazon Associate we earn from qualifying purchases.