With CASE statements available now in SQL SELECT, lots of logic can be embedded in SQL statements. Although RUNSQLSTM does not allow SELECTs, it can do INSERT INTO TABLE VALUES(SELECT ....) and the logic could be there.

Or go with QMQRYs, which allow for replacement variables. And can run anything in SQL. Has outfile capabilities, etc. And outfile can *REPLACE contents of destination - dangerous, maybe, and very handy.

You COULD even generate the CSV directly, but the SQL gets messier with lots of concatenation and casting of data types. CPYTOIMPF is probably easier.

Vern

At 12:10 PM 3/19/2004 -0500, you wrote:
It will be something that will execute on a nightly basis. I'll be
refreshing the target database every night. Also, the logic is a bit
tricky.

On Fri, 19 Mar 2004 11:07:36 -0600, "Elvis Budimlic"
<ebudimlic@xxxxxxxxxxxxxxxxxxxxxxxxx> said:
> If it's a one time shot why write programs?
> I find it much easier to write SQL for this kind of work. It's quick and
> flexible.
> You can save your SQL statements into a source member and execute them as
> a
> script using RUNSQLSTM later on if the need for this arises again.
>
> Elvis
>
> -----Original Message-----
>  Subject: SQL Vs. RPG Opinions
>
> I have a need to populate many files from an established iSeries
> database. I would normally write some RPG/IV code to get the data I need
> and write to the files - standard stuff. However, these files are going
> to mimic a relational structure on a different system - after I create
> the files, I'll convert them to comma delimited format and send them to
> the target system where they'll be used as input for tables.
>
> So, I'm really creating tables on my iSeries and sending them to the
> other system. Should I use SQL to do this? I've used SQL to create the
> tables and I could develop the SQL to populate the tables, but I'm
> wondering if it even makes sense to do this.
>
> Thoughts?
>
>
> _______________________________________________
> 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.
>
--

michaelr_41@xxxxxxxxxxxxxx

--
http://www.fastmail.fm - mmm... Fastmail...
_______________________________________________
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.



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-2022 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.