Thread: COBOL

INITIALIZE cleared my indexes and I did not notice

Started by Alex • user3 replies166 viewsLast activity 2 weeks ago
Post #1
0 votes
Alex
Reputation
8
Posts: 35
Joined: Jun 15, 2026, 9:20 AM
Posted: Jul 30, 2026, 12:19 PM

INITIALIZE WS-TABLE before a reload. Later SEARCH blew up. Turns out INDEXED BY indexes got zeroed and I never SET them again.

Is that expected? Feels like a footgun.

Post #2
1 votes
Marty
Reputation
412
Posts: 58
Joined: Aug 12, 2024, 9:14 AM
Posted: Jul 30, 2026, 3:19 PM

Expected. INITIALIZE resets index-names associated with the group. SET IND TO 1 after, or INITIALIZE only the data fields you care about.

I initialize elementary items or use MOVE of a prebuilt empty clone when indexes are involved.

Post #3
0 votes
Alex
Reputation
8
Posts: 35
Joined: Jun 15, 2026, 9:20 AM
Posted: Jul 30, 2026, 7:19 PM

SET after INITIALIZE. Adding that to my checklist.

You must be signed in to reply to this thread