Translating with DrWatson… this can take a few seconds the first time.
This is a genuine, complex translation. DrWatson protects commands, error codes, and log output while naturally translating the surrounding text. It’s translated once and saved.
steveFarris wanted to assign a slice of one 4GL record to another (a1[0,9] = a2[1,10]) for two tables differing by one column. Jonathan Leffler said whole-record LET a1.* = a2.* works but array slices cannot be copied; elements must be copied one at a time. Andrew Pearson suggested LET a1.* = a2.one THROUGH a1.ten, or explicit element lists, noting he was unsure of the syntax. No confirmation from the poster.
Auto-generated by Claude from the posts below — may be imperfect; read the full thread.
steveFarris — — source: Informix-list mailing list archive (1991-1998)
Hi, I have two tables that differ only by one row. I want to do
something like:
define
a1 record like tableOne
a2 record like tabletwo
let a1[0,9] = a2[1,10]
Anybody know how??
↪ replying to steveFarris
Jonathan Leffler — — source: Informix-list mailing list archive (1991-1998)
steveFarris wrote:
> Hi, I have two tables that differ only by one row. I want to do
> something like:
>
> define
> a1 record like tableOne
> a2 record like tabletwo
>
> let a1[0,9] = a2[1,10]
>
> Anybody know how??
Well, you can do whole record assignments: LET a1.* = a2.*
Since you've only defined single records, not arrays, your options are
rather limited. However, even if you had an array, and you got around
the errors due to arrays being 1-based rather than 0-based, you cannot
copy slices of arrays like that; you'd have to copy one element at a
time.
--
Jonathan Leffler (jleffler@informix.com, jleffler@earthlink.net)
Guardian of DBD::Informix v1.00.PC1 -- see http://www.perl.com/CPAN
#include <disclaimer.h>
↪ replying to steveFarris
Jonathan Leffler — — source: Informix-list mailing list archive (1991-1998)
steveFarris wrote:
> Hi, I have two tables that differ only by one row. I want to do
> something like:
>
> define
> a1 record like tableOne
> a2 record like tabletwo
>
> let a1[0,9] = a2[1,10]
>
> Anybody know how??
Well, you can do whole record assignments: LET a1.* = a2.*
Since you've only defined single records, not arrays, your options are
rather limited. However, even if you had an array, and you got around
the errors due to arrays being 1-based rather than 0-based, you cannot
copy slices of arrays like that; you'd have to copy one element at a
time.
--
Jonathan Leffler (jleffler@informix.com, jleffler@earthlink.net)
Guardian of DBD::Informix v1.00.PC1 -- see http://www.perl.com/CPAN
#include <disclaimer.h>
↪ replying to steveFarris
Andrew Pearson — — source: Informix-list mailing list archive (1991-1998)
steveFarris wrote:
>
> Hi, I have two tables that differ only by one row. I want to do
> something like:
>
> define
> a1 record like tableOne
> a2 record like tabletwo
>
> let a1[0,9] = a2[1,10]
>
> Anybody know how??
Sorry, I'm not quite understanding your pseudocode here. Do you
mean that you want to assign the values from the second to tenth
members of one record (a2) to the first to ninth members of the
other (a1) record?
In which case and using 4GL you can do something like:
LET a1.* = a2.one THROUGH a1.ten
Or at least I think so, no manuals handy so I have likely munged
the syntax. It will definitely work if you explicitly assign the
elements (LET a1.* = a2.one, a2.two, a1.three etc.).
With arrays of course you can only handle element at a time so a
bit of attention to your looping structure will take care of
getting the right element from one lined up with the other.
--
Andrew Pearson: "exactly what the web needs less of".
We use strictly necessary cookies to make this site work. With your
consent we’d also use optional cookies for analytics and marketing. You can accept all,
reject all, or choose. Read our Cookie Policy.