× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



On Thu, Jul 17, 2014 at 3:50 PM, Richard Reeve <rjrjr64@xxxxxxxxx> wrote:
Basically, what I'm doing is reading multiple files in a db2 database
(using RPG) and building these output records as I go Where I am getting
tripped up is:

Good. This means that you are not getting tripped up with other
stuff! That limits the scope of the help you need from the rest of
us.

1. Should I just create data structures for each record type and
write to a file defined with a record length of say 400 (the longest of the
record types plus 50 for the delimiters that I'll be adding or would it be
wiser to create actual files for each record type (adding employee # to
each as a hidden field so that I can properly order the extract file).

A single output file is probably going to be easier than lots of
separate output files. As Buck points out, if you need to reorder the
records after you generate them, then you'll want your file to have
not just the one 400-character field, but also whatever keys you need.
If you are reading in the data such that you can make your program
spit out the records in the correct order, then you can skip the key
fields.

2. I am confused as to how to get the pipe delimiter in the extract
file efficiently and removing trailing blanks.

Jeff already mentioned %TRIM. Of course you have to convert any data
that isn't already character to character. %CHAR and, depending on
requirements, %EDITC are useful for this.

Earlier you mentioned data structures. I don't think you should be
thinking in terms of data structures too strongly. I mean, you can
use them, sure. But ultimately they don't buy you as much in this
situation as they do in other situations. You need to think in terms
of fields or variables, because you have to insert the delimiters
yourself. See the earlier code sample from Mike, except that you need
to do a lot of %char and %trim (and possibly adding quotation marks as
well).

Thanks again to all of you for your guidance and suggestions. I truly
appreciate it.

If I may ask, what is your deadline? A lot of these issues melt away
if you use Python, or similar "very-high-level languages" like Perl,
Ruby, or PHP. (Those last two definitely have IBM-blessed PASE
implementations.)

Even if you don't have time to learn Python now, for this project,
it's worth picking up because you can definitely find uses for it
later.

John

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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

This mailing list archive is Copyright 1997-2024 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].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.