Hi

I'm having some trouble trouble with cobol tables and was wondering if anyone could help show me where i'm going wrong?

Here is the layout of the tables im using.

01 WS-TBS1-TABLE.

05 WS-TBS1 OCCURS 50 TIMES.

10 WS1-NAME PIC X(20).

10 WS1-ADDRESS PIC X(30).

10 WS1-DEPT PIC X(04).

10 WS1-SALARY PIC X(05).

10 WS1-PEN-DESC PIC X(08).

10 WS1-PEN-TYPE PIC X(02) VALUE 'P1'.

So i basically have 5 tables like this (WS-TBS1-TABLE to WS-TBS5-TABLE). Then i have another exactly the same called WS-TBSA-TABLE.

What i need to do is move the first occurrence of tables WS-TBS1-TABLE to WS-TBS5-TABLE to the first occurrence of WS-TBSA-TABLE, then the second occurrence etcâ€¦ until WS-TBSA-TABLE has 50 occurrences.

Here is the code i have been using.

MOVE 0 TO I.

MOVE 0 TO X.

PARA-1.

IF X < 50 AND WS-TBS1(I) NOT = SPACES

MOVE WS-TBS1(I) TO WS-TBSA(X)

ADD 1 TO X.

IF X < 50 AND WS-TBS2(I) NOT = SPACES

MOVE WS-TBS2(I) TO WS-TBSA(X)

ADD 1 TO X.

IF X < 50 AND WS-TBS3-TABLE(I) NOT = SPACES

MOVE WS-TBS3(I) TO WS-TBSA(X)

ADD 1 TO X.

IF X < 50 AND WS-TBS4(I) NOT = SPACES

MOVE WS-TBS4(I) TO WS-TBSA(X)

ADD 1 TO X.

IF X < 50 AND WS-TBS5(I) NOT = SPACES

MOVE WS-TBS5(I) TO WS-TBSA(X)

ADD 1 TO X.

ADD 1 TO I

GO TO PARA-1.

I've been getting the following errors when trying to compile this:

"WS1-NAME OF WS-TBS1" was a table element but was not subscripted or indexed. The first occurrence of the table element was assumed.

I basically get this error for every table.

I've never really used cobol only had basic training. So any help would be grateful. If you's need to know any more info let me know.

Many thanks.