Thread: General

Easytrieve SQL FETCH - how do I stuff rows into an array?

Started by Omar • user3 replies140 viewsLast activity 2 weeks ago
Post #1
1 votes
Omar
Reputation
155
Posts: 12
Joined: Jan 7, 2025, 10:05 AM
Posted: Jul 28, 2026, 8:16 AM

Cursor returns multiple ages for one policy. I can FETCH into a single host field. How do people load an OCCURS table from that?

SQL FETCH CURSOR3 INTO :W-AGE ... then what?

Post #2
0 votes
Elena
Reputation
391
Posts: 19
Joined: Apr 18, 2024, 9:30 AM
Posted: Jul 28, 2026, 10:16 AM

Fetch into a scalar, then move into the next OCCURS slot. Loop until SQLCODE 100. Do not try to FETCH straight into W-AGE(I) unless your release docs say that works (ours does not).

DEFINE W-AGES W 3 N OCCURS 50
I = 1
DO WHILE ...
SQL FETCH ... INTO :W-ONE-AGE
W-AGES(I) = W-ONE-AGE
I = I + 1
END-DO

Post #3
0 votes
Omar
Reputation
155
Posts: 12
Joined: Jan 7, 2025, 10:05 AM
Posted: Jul 29, 2026, 9:16 AM

Scalar then move worked. Was overthinking it.

You must be signed in to reply to this thread