You never really addressed what I was looking for in my comment, and now you've edited the question so my comment doesn't even really make sense. (For what it's worth, my suggestion of CPYF
was probably not a good idea, but my understanding of your situation was, and still is, quite lacking.)
Based on something you said in your earlier edit, I am wondering if all the records in CMPALTDEV
are actually duplicates of each other (with enough copies to match the number of records in ALLISERIES
). If so, then the simplest thing to do is probably dispense with any attempt to join, and just plug in the values from CMPALTDEV
by brute force. For example, if blank and 'AS400 PRIM'
are effectively the constant values you are trying to associate with each of the ALLISERIES.SYSNAM
values, then make an empty copy of CMPALTDEV
(I'll call it CMPALTDEV2
) and just hard-code the constant values as follows:
INSERT INTO CMPALTDEV2
SELECT SYSNAM, '', 'AS400 PRIM' FROM ALLISERIES
On the other hand, if the values in CMPALTDEV
vary, and what you really want to do is match by "relative record number", IBM does give you the RRN
function to do so:
INSERT INTO CMPALTDEV2
SELECT T1.SYSNAM, T2.DIADEV, T2.DITOPG
FROM ALLISERIES T1
JOIN CMPALTDEV T2 ON RRN(T1) = RRN(T2)
Please note: Using the relative record number is a pretty hackish way to do anything in SQL. It's full of potential pitfalls, and really goes against what SQL is meant to be. Most implementations of SQL (for other databases) don't have anything analogous to RRN
, and best practice is to avoid using it if you can help it, even on the IBM i.