Define the definition of the COBOL Table.

All sort of Mainframes Interview Questions.
Post Reply
Prakash Jha
Registered Member
Posts: 62
Joined: Sat Jun 29, 2013 1:45 pm
India

Define the definition of the COBOL Table.

Post 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?
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1895
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: Define the definition of the COBOL Table.

Post 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.
Prakash Jha
Registered Member
Posts: 62
Joined: Sat Jun 29, 2013 1:45 pm
India

Re: Define the definition of the COBOL Table.

Post 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?
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1895
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: Define the definition of the COBOL Table.

Post 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.
Prakash Jha
Registered Member
Posts: 62
Joined: Sat Jun 29, 2013 1:45 pm
India

Re: Define the definition of the COBOL Table.

Post by Prakash Jha »

Thank you Robert.
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “Interview Questions.”