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



Google SQL and "numbers table"

now consider
select 'P', b.num, c.num, d.num
from numtbl B, numtbl C, numtbl D
where b.num between 1 and 99
and c.num between 1 and 7
and d.num between 1 and 7

Not sure what to make of "only insert the record, if the record is not
already there". With what you've told us, there's no reason to go to the
additional trouble. It's easier to simply generate the whole table.

Assuming there's more to it, I'd generate the whole thing above, then
update the new table with data from the existing. If you are on 7.1, you
could take advantage of the MERGE statement.

HTH,
CHarles



On Wed, Sep 4, 2013 at 4:28 PM, Alan Shore <ashore@xxxxxxxx> wrote:

Hi guys
First of all apologies for the subject line.
I'm not too sure if it explains what I am looking for.
Anyway - before I forget - we are on V5r4

What I need to do is add records to a particular file.
The file record is pretty simple
FieldA 1
FieldB 2 0
FieldC 1 0
FieldD 3 0

FieldA will be a constant value P
FieldB values 1 thru 99 inclusive
FieldC values 1 thru 7 inclusive
FieldD values 1 thru 7 inclusive

The new records need to be as the following
FieldA FieldB FieldC FieldD
P 1 1 1
P 1 1 2
P 1 1 3
P 1 1 4
P 1 1 5
P 1 1 6
P 1 1 7
P 1 2 1
P 1 2 2
Etc.
FieldC will eventually max out at 7, changing to 1 with the next record
while FieldB will go to 2
Hopefully, this makes sense - but the question becomes - is this possible
to do in SQL?
Then as if that's not hard enough, only insert the record, if the record
is not already there.
I probably will have to do this in RPGILE, but I was just wondering if it
could be done in SQL
I tried googling count and sequence to no avail

Anyway - as always - all answers gratefully accepted

Alan Shore
E-mail : ASHORE@xxxxxxxx
Phone [O] : (631) 200-5019
Phone [C] : (631) 880-8640


Disclaimer: This message contains confidential information and is intended
only for the individual named. If you are not the named addressee you
should not disseminate, distribute or copy this e-mail. Please notify the
sender immediately by e-mail if you have received this e-mail by mistake
and delete this e-mail from your system. E-mail transmission cannot be
guaranteed to be secure or error-free as information could be intercepted,
corrupted, lost, destroyed, arrive late or incomplete, or contain viruses.
The sender therefore does not accept liability for any errors or omissions
in the contents of this message, which arise as a result of e-mail
transmission. If verification is required please request a hard-copy
version. Any views or opinions presented are solely those of the author and
do not necessarily represent those of the company.
--
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 ...

Follow-Ups:
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.