# Data descriptor

> Mediated Wiki article. Canonical URL: https://mediated.wiki/source/Data_descriptor
> Markdown URL: https://mediated.wiki/source/Data_descriptor.md
> Source: https://en.wikipedia.org/wiki/Data_descriptor
> Source revision: 1306478399
> License: Creative Commons Attribution-ShareAlike 4.0 International (https://creativecommons.org/licenses/by-sa/4.0/)

In [computing](/source/computing), a '''data descriptor''' is a structure containing information that describes data.

Data descriptors may be used in [compiler](/source/compiler)s,<ref>{{cite journal |last=Holt |first=Richard C. |date=July 1987 |title=Data descriptors: a compile-time model of data and addressing |journal=ACM Transactions on Programming Languages and Systems |doi=10.1145/24039.24051 |volume=9 |issue=3 |pages=367–389|doi-access=free }}</ref> as a software structure at run time in languages like [Ada](/source/Ada_(programming_language))<ref>{{cite web |last=Schonberg |first=Ed |title=Ada Compared with C++ |work=The Advantages of Ada 95 |url=http://archive.adaic.com/intro/ada-vs-c/ada-vs-c.html |accessdate=January 15, 2013}}</ref>  or [PL/I](/source/PL%2FI), or as a hardware structure in some computers such as [Burroughs large systems](/source/Burroughs_large_systems) with their [descriptors](/source/Burroughs_large_systems_descriptors).

Data descriptors are typically used at run-time to pass argument information to called [subroutines](/source/subroutines).  [OpenVMS](/source/OpenVMS)<ref>{{cite web |author=Hewlett-Packard |title=Chapter 7 OpenVMS Argument Descriptors |work=HP OpenVMS Systems Documentation |url=http://h30266.www3.hpe.com/odl/axpos/opsys/vmsos84/5973/5973pro_011.html#arg_desc_formats_chap |accessdate=July 11, 2020 |archive-date=July 13, 2020 |archive-url=https://web.archive.org/web/20200713183506/http://h30266.www3.hpe.com/odl/axpos/opsys/vmsos84/5973/5973pro_011.html#arg_desc_formats_chap |url-status=dead }}</ref> and [Multics](/source/Multics)<ref>{{cite book |author=Honeywell, Inc. |date=1979 |title=Multics Programmers' Manual – Subsystem Writers' Guide |pages=2&ndash;13-2&ndash;18 |url=http://bitsavers.informatik.uni-stuttgart.de/pdf/honeywell/multics/AK92-2_MPM_SubsysWrtGud_Mar79.pdf |format=PDF}}</ref>  have system-wide language-independent standards for argument descriptors.  Descriptors are also used to hold information about data that is only fully known at run-time, such as a [dynamically allocated array](/source/dynamic_memory_allocation).

==Examples==
The following descriptor is used by IBM ''Enterprise PL/I'' to describe a [character string](/source/String_(computer_science)):<ref>{{cite book |author=IBM Corporation |date=2006|title=Enterprise PL/I for z/OSProgramming Guide |pages=385 |url=http://pic.dhe.ibm.com/infocenter/pdthelp/v1r1/topic/com.ibm.entpli.doc_3.6/ibm3pg50.pdf |format=PDF}}</ref>
{| class=wikitable style="text-align:center;"
! byte offset !! +0 !! +1 !! +2 !! +3
|-
! 0
| descriptor type || string type || (res) || flags
|-
! 4
| colspan=4 | maximum string length
|}
* 'desc type' is 2 to indicate that this is an element descriptor rather than an array or structure descriptor.
* 'string type' indicates that this is a character or a bit string, with varying or non varying length.  2 indicates a non varying (fixed-length) character string.
*  '(res)' is a reserved byte not used for character strings.
* 'flags' indicate the encoding of the string, [EBCDIC](/source/EBCDIC) or [ASCII](/source/ASCII), and the encoding of the length of varying strings.
* 'maximum string length' is the actual length of the string for non varying strings, or the maximum length for varying strings.

Here is the source of an [array](/source/Array_data_structure) descriptor from Multics.<ref>{{cite web |author=MIT/Honeywell |title=array.incl.pl1 |work=Multics/ldd/include |url=http://web.mit.edu/multics-history/source/Multics/ldd/include/array.incl.pl1 |accessdate=January 20, 2012}}</ref>  The definitions include a structure for the base array information and a structure for each dimension. (Multics ran on systems with 36-bit words).

<pre>
dcl	1 array			        based    aligned,
	2 node_type		        bit(9)   unaligned,
	2 reserved		        bit(34)  unaligned,
	2 number_of_dimensions	        fixed(7) unaligned,
	2 own_number_of_dimensions	fixed(7) unaligned,
	2 element_boundary		fixed(3) unaligned,
	2 size_units		        fixed(3) unaligned,
	2 offset_units		        fixed(3) unaligned,
	2 interleaved		        bit(1)   unaligned,
	2 c_element_size		fixed(24),
	2 c_element_size_bits	        fixed(24),
	2 c_virtual_origin		fixed(24),
	2 element_size		        ptr unaligned,
	2 element_size_bits		ptr unaligned,
	2 virtual_origin		ptr unaligned,
	2 symtab_virtual_origin	        ptr unaligned,
	2 symtab_element_size	        ptr unaligned,
	2 bounds			ptr unaligned,
	2 element_descriptor	        ptr unaligned;

dcl	1 bound			        based aligned,
	2 node_type		        bit(9),
	2 c_lower			fixed(24),
	2 c_upper			fixed(24),
	2 c_multiplier		        fixed(24),
	2 c_desc_multiplier		fixed(24),
	2 lower			        ptr unaligned,
	2 upper			        ptr unaligned,
	2 multiplier		        ptr unaligned,
	2 desc_multiplier		ptr unaligned,
	2 symtab_lower		        ptr unaligned,
	2 symtab_upper		        ptr unaligned,
	2 symtab_multiplier		ptr unaligned,
	2 next			        ptr unaligned;
</pre>

==See also==
*[Burroughs large systems descriptors](/source/Burroughs_large_systems_descriptors)

==References==
{{Reflist}}

Category:Data structures by computing platform
Category:Programming language implementation

{{compu-prog-stub}}

---
Adapted from the Wikipedia article [Data descriptor](https://en.wikipedia.org/wiki/Data_descriptor) by Wikipedia contributors ([contributor history](https://en.wikipedia.org/wiki/Data_descriptor?action=history)). Available under [Creative Commons Attribution-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/). Changes may have been made.
