COBOL Confusion?

The answer is that it allocates the maximum amount of space (90 entries). Note that this is for space in working storage When the record is written to a file only the relevant portion is written An example: 01 TABLE-SIZE PIC 9 01 TABLE OCCURS 1 TO 9 TIMES DEPENDING ON TABLE-SIZE 03 FLD1 PIC X(4) This will allocate 36 character for TABLE in working storage. If TABLE-SIZE is set to 2 when the record is written to a file, only 8 characters will be written (over and above the characters written for TABLE-SIZE of course) Similarly, when the record is read back in, both TABLE-SIZE and the relevant bits of TABLE will be populated from the file.

I don't believe that the unused TABLE entries are initialized to anything when that occurs. It's best to assume not anyway, and populate them explicitly if you need to add another item to the table.

The answer is that it allocates the maximum amount of space (90 entries). Note that this is for space in working storage. When the record is written to a file, only the relevant portion is written.

An example: 01 TABLE-SIZE PIC 9 01 TABLE OCCURS 1 TO 9 TIMES DEPENDING ON TABLE-SIZE 03 FLD1 PIC X(4) This will allocate 36 character for TABLE in working storage. If TABLE-SIZE is set to 2 when the record is written to a file, only 8 characters will be written (over and above the characters written for TABLE-SIZE, of course). Similarly, when the record is read back in, both TABLE-SIZE and the relevant bits of TABLE will be populated from the file.

I don't believe that the unused TABLE entries are initialized to anything when that occurs. It's best to assume not anyway, and populate them explicitly if you need to add another item to the table.

This was precisely what I was trying to understand. Thank you for your time and knowledge. – Enyalius Mar 29 '09 at 0:26.

We don't have quite enough information here, but the basic thing is that the variable named in the DEPENDING ON clause has to have a count of the variable number of groups. So you need something like 01 TABLE-SIZE PIC 99 01 TABLE OCCURS 1 TO 90 TIMES DEPENDING ON TABLE-SIZE 03 FIELD-1 03 FIELD-2 and so on. See this article or this article at Publib.

Thank you very much for the reference material, Charlie. I shall review it, and I am certain that it will help me in the future Thanks! – Enyalius Mar 29 '09 at 0:26.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions