You did not indicate if delimited (comma separated or pipe delimited or
similar) or if each record type is fixed length columns (not fixed length
record) or even if some fields fixed plus block data variable.
All of this is quite common.
My preference for this is one RPGLE that can read an IFS stream file, and
after each read, push the whole record into a data structure defined for
that record type. As long as the block data does not exceed 32,000 bytes (or
whatever current limit is..)
Scott Klement wrote a tutorial and sample programs many, many years ago.
It's just RPGLE. Samples for reading and writing and updating IFS files,
plus a clear explanation of how it works.
My pgms still carry the reference to where the sample originated.
Copied from IFSEBOOK/QRPGLESRC/CH5ASCII: Example of reading text file in
ASCII mode
http://www.scottklement.com/rpg/ifs.html


If you are not comfortable with that, build a native file with one field
for xx,xxx bytes (bigger than any possible record, and then
CPYFRMIMPF FROMSTMF('/XXXF/YYYYYY/ABCDEBU.TXT')
TOFILE(FLATFILE) MBROPT(*REPLACE) +
RCDDLM(*CRLF) RPLNULLVAL(*FLDDFT)

May have to adjust for whatever record delimiter.

Then push each record into correct data structure (if fixed width columns).

Jim Franz



-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of John
R. Smith, Jr.
Sent: Saturday, November 07, 2015 11:39 AM
To: midrange-l@xxxxxxxxxxxx
Subject: Copying data from IFS to DB2

I have a multi-record variable length format IFS file that I need to copy to
a DB2 file. The first few fields are "keys" and a record type and then there
is a "block" data field similar to the layout shown below. The record
length and block data layout vary based on the record type.



Store

Register

Transaction

Timestamp

RecordType

BlockData



I can't seem to get CPYFRMIMPF or CPYFRMSTMF to work due to various
reasons/errors. Should one of these two commands work and I just have the
parameters set wrong, is there another command that I'm not thinking of, or
am I stuck trying to write my own program to read the IFS and write the DB2.

--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe,
or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at http://archive.midrange.com/midrange-l.


This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].