Page 1 of 1
Define the definition of the COBOL Table.
Posted: Mon Nov 12, 2018 11:17 am
by Prakash Jha
Hi,
Interviewer gave me this definition of tables in COBOL -
Code: Select all
01 WS-TABLE-DEF.
05 WS-MAIN-TABLE OCCURS 10 TIMES.
10 WS-FIRST-CHILD OCCURS 30 TIMES
15 WS-CHILD-CHILD PIC 9(5) OCCURS 10 TIMES
10 WS-SECOND-MAIN-TABLE PIC 9(4) OCCURS 20 TIMES
10 WS-THIRD-MAIN-TABLE PIC 9(3) OCCURS 20 TIMES
And asked to represent the table hirearchy. I could not really explain it well, can someone please guide me on this?
Re: Define the definition of the COBOL Table.
Posted: Mon Nov 12, 2018 7:50 pm
by Robert Sample
I would say something like "WS-TABLE-DEF has 10 occurrences of WS-MAIN-TABLE. WS-MAIN-TABLE has 30 occurrences of WS-FIRST-CHILD, 20 occurrences of WS-SECOND-MAIN-TABLE, and 20 occurrences of WS-THIRD-MAIN-TABLE. WS-FIRST-CHILD in turn has 10 occurrences of WS-CHILD-CHILD." The table hierarchy won't have any information about the size of any elementary items since you're only looking at how the table is laid out.
Re: Define the definition of the COBOL Table.
Posted: Fri Feb 22, 2019 10:55 am
by Prakash Jha
Robert Sample wrote: Mon Nov 12, 2018 7:50 pmI would say something like "WS-TABLE-DEF has 10 occurrences of WS-MAIN-TABLE. WS-MAIN-TABLE has 30 occurrences of WS-FIRST-CHILD, 20 occurrences of WS-SECOND-MAIN-TABLE, and 20 occurrences of WS-THIRD-MAIN-TABLE. WS-FIRST-CHILD in turn has 10 occurrences of WS-CHILD-CHILD." The table hierarchy won't have any information about the size of any elementary items since you're only looking at how the table is laid out.
Thanks Robert.
Is it really a good question, what do you say? I was not sure that if for some reason I am not able to answer this question, will that really say about ability to work on a project?
Re: Define the definition of the COBOL Table.
Posted: Fri Feb 22, 2019 11:08 pm
by Robert Sample
I would rate it as a so-so question. It does require some knowledge of COBOL to adequately answer, but it doesn't really explore the depth of COBOL knowledge. I would ask about the length of WS-FIRST-CHILD to verify the person's understanding of both OCCURS and PIC clauses.
Re: Define the definition of the COBOL Table.
Posted: Thu Dec 03, 2020 8:07 pm
by Prakash Jha
Thank you Robert.