Page 1 of 1

Difference between CSECT and DSECT?

Posted: Mon Jun 08, 2015 6:17 pm
by Rajeev Singh
What is difference between CSECT and DSECT? I read some defintion of then but they are tough to comphehend:
A DSECT or Dummy Section provides the programmer with the ability to describe the layout of an area of storage without reserving virtual storage for the area that is described. The DSECT layout can then be used to reference any area of storage which is addressable by the program. Think of the DSECT as a template, or pattern, which can be “dropped” on any area of storage. Once the DSECT is “positioned”, the symbolic names in the DSECT can be used to extract data from the underlying storage area.

By definition, a control section (CSECT) is “a block of coding that can be relocated (independent of other coding) without altering the operating logic of the program”.For the modern programmer, a CSECT might be considered as an independentcode module or package. The match in terminology is not precise, but suggestive.
Can you please explain them for a newbie.

Re: Difference between CSECT and DSECT?

Posted: Mon Jun 08, 2015 10:52 pm
by Robert Sample
A CSECT includes code and may include data. It has a certain amount of storage allocated to it. Every program has at least one CSECT (whether or not it is explicit).

A DSECT, on the other hand, has NO storage allocated to it -- in order to use variables in the DSECT you must indicate where the storage for the DSECT is (via the USING instruction).