Thread: COBOL

How do I make an array / table in COBOL?

Started by Alex • user3 replies202 viewsLast activity 3 weeks ago
Post #1
0 votes
Alex
Reputation
8
Posts: 35
Joined: Jun 15, 2026, 9:20 AM
Posted: Jul 23, 2026, 10:16 AM

Need a list of 50 account numbers. In other languages I would use an array. Is that OCCURS?

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

Yes.

01 WS-ACCT-TABLE.
05 WS-ACCT-NUM PIC 9(8) OCCURS 50 TIMES.

Then WS-ACCT-NUM (3) is the third one. Subscripts start at 1, not 0.

Post #3
0 votes
Priya
Reputation
56
Posts: 17
Joined: Aug 17, 2025, 2:03 PM
Posted: Jul 23, 2026, 4:16 PM

Starting at 1 got me at least twice coming from Java.

You must be signed in to reply to this thread