Contents 1 Keys 2 History 3 Operations 3.1 Assignment and comparison 3.2 Algol 68's distributive field selection 3.3 Pascal's "with" statement 4 Representation in memory 5 Self-defining records 6 Examples 7 See also 8 References


Keys[edit] A record may have zero or more keys. A key is a field or set of fields in the record that serves as an identifier. A unique key is often called the primary key, or simply the record key. For example an employee file might contain employee number, name, department, and salary. The employee number will be unique in the organization and would be the primary key. Depending on the storage medium and file organization the employee number might be indexed—that is also stored in a separate file to make lookup faster. The department code may not be unique; it may also be indexed, in which case it would be considered a secondary key, or alternate key. If it is not indexed the entire employee file would have to be scanned to produce a listing of all employees in a specific department. The salary field would not normally be considered usable as a key. Indexing is one factor considered when designing a file.


History[edit] Journal sheet from 1880 United States Census, showing tabular data with rows of data, each a record corresponding to a single person. The concept of record can be traced to various types of tables and ledgers used in accounting since remote times. The modern notion of records in computer science, with fields of well-defined type and size, was already implicit in 19th century mechanical calculators, such as Babbage's Analytical Engine.[citation needed] Hollerith punched card (1895) The original machine-readable medium used for data (as opposed to control) was punch card used for records in the 1890 United States Census: each punch card was a single record. Compare the journal entry from 1880 and the punch card from 1895. Records were well established in the first half of the 20th century, when most data processing was done using punched cards. Typically each record of a data file would be recorded in one punched card, with specific columns assigned to specific fields. Generally, a record was the smallest unit that could be read in from external storage (e.g. card reader, tape or disk). Most machine language implementations and early assembly languages did not have special syntax for records, but the concept was available (and extensively used) through the use of index registers, indirect addressing, and self-modifying code. Some early computers, such as the IBM 1620, had hardware support for delimiting records and fields, and special instructions for copying such records. The concept of records and fields was central in some early file sorting and tabulating utilities, such as IBM's Report Program Generator (RPG). COBOL was the first widespread programming language to support record types,[3] and its record definition facilities were quite sophisticated at the time. The language allows for the definition of nested records with alphanumeric, integer, and fractional fields of arbitrary size and precision, as well as fields that automatically format any value assigned to them (e.g., insertion of currency signs, decimal points, and digit group separators). Each file is associated with a record variable where data is read into or written from. COBOL also provides a MOVE CORRESPONDING statement that assigns corresponding fields of two records according to their names. The early languages developed for numeric computing, such as FORTRAN (up to FORTRAN IV) and Algol 60, did not have support for record types; but later versions of those languages, such as Fortran 77 and Algol 68 did add them. The original Lisp programming language too was lacking records (except for the built-in cons cell), but its S-expressions provided an adequate surrogate. The Pascal programming language was one of the first languages to fully integrate record types with other basic types into a logically consistent type system. The PL/I programming language provided for COBOL-style records. The C programming language initially provided the record concept as a kind of template (struct) that could be laid on top of a memory area, rather than a true record data type. The latter were provided eventually (by the typedef declaration), but the two concepts are still distinct in the language. Most languages designed after Pascal (such as Ada, Modula, and Java) also supported records.


Operations[edit] Declaration of a new record type, including the position, type, and (possibly) name of each field; Declaration of variables and values as having a given record type; Construction of a record value from given field values and (sometimes) with given field names; Selection of a field of a record with an explicit name; Assignment of a record value to a record variable; Comparison of two records for equality; Computation of a standard hash value for the record. The selection of a field from a record value yields a value. Some languages may provide facilities that enumerate all fields of a record, or at least the fields that are references. This facility is needed to implement certain services such as debuggers, garbage collectors, and serialization. It requires some degree of type polymorphism. In systems with record subtyping, operations on values of record type may also include: Adding a new field to a record, setting the value of the new field. Removing a field from a record. In such settings, a specific record type implies that a specific set of fields are present, but values of that type may contain additional fields. A record with fields x, y, and z would thus belong to the type of records with fields x and y, as would a record with fields x, y, and r. The rationale is that passing an (x,y,z) record to a function that expects an (x,y) record as argument should work, since that function will find all the fields it requires within the record. Many ways of practically implementing records in programming languages would have trouble with allowing such variability, but the matter is a central characteristic of record types in more theoretical contexts. Assignment and comparison[edit] Most languages allow assignment between records that have exactly the same record type (including same field types and names, in the same order). Depending on the language, however, two record data types defined separately may be regarded as distinct types even if they have exactly the same fields. Some languages may also allow assignment between records whose fields have different names, matching each field value with the corresponding field variable by their positions within the record; so that, for example, a complex number with fields called real and imag can be assigned to a 2D point record variable with fields X and Y. In this alternative, the two operands are still required to have the same sequence of field types. Some languages may also require that corresponding types have the same size and encoding as well, so that the whole record can be assigned as an uninterpreted bit string. Other languages may be more flexible in this regard, and require only that each value field can be legally assigned to the corresponding variable field; so that, for example, a short integer field can be assigned to a long integer field, or vice versa. Other languages (such as COBOL) may match fields and values by their names, rather than positions. These same possibilities apply to the comparison of two record values for equality. Some languages may also allow order comparisons ('<'and '>'), using the lexicographic order based on the comparison of individual fields.[citation needed] PL/I allows both of the preceding types of assignment, and also allows structure expressions, such as a = a+1; where "a" is a record, or structure in PL/I terminology. Algol 68's distributive field selection[edit] In Algol 68, if Pts was an array of records, each with integer fields X and Y, one could write Pts.Y to obtain an array of integers, consisting of the Y fields of all the elements of Pts. As a result, the statements Pts[3].Y := 7 and Pts.Y[3] := 7 would have the same effect. Pascal's "with" statement[edit] In the Pascal programming language, the command with R do S would execute the command sequence S as if all the fields of record R had been declared as variables. So, instead of writing Pt.X := 5; Pt.Y := Pt.X + 3 one could write with Pt do begin X := 5; Y := X + 3 end.


Representation in memory[edit] The representation of records in memory varies depending on the programming languages. Usually the fields are stored in consecutive positions in memory, in the same order as they are declared in the record type. This may result in two or more fields stored into the same word of memory; indeed, this feature is often used in systems programming to access specific bits of a word. On the other hand, most compilers will add padding fields, mostly invisible to the programmer, in order to comply with alignment constraints imposed by the machine—say, that a floating point field must occupy a single word. Some languages may implement a record as an array of addresses pointing to the fields (and, possibly, to their names and/or types). Objects in object-oriented languages are often implemented in rather complicated ways, especially in languages that allow multiple class inheritance.


Self-defining records[edit] A self-defining record is a type of record which contains information to identify the record type and to locate information within the record. It may contain the offsets of elements; the elements can therefore be stored in any order or may be omitted.[4] Alternatively, various elements of the record, each including an element identifier, can simply follow one another in any order.


Examples[edit] The following show examples of record definitions: PL/I: declare 1 date, 2 year fixed binary, 2 month fixed binary, 2 day fixed binary; C: struct date { int year; int month; int day; }; Go: type Date struct { year: int, month: time.Month, day: int, } Rust: struct Date { year: u32, month: u32, day: u32, } Haskell: data Date = Date { year :: Integer , month :: Integer , day :: Integer }


See also[edit] Block (data storage) Composite data type Cons cell Data hierarchy Data structure alignment Object composition Row (database) Storage record Passive data structure


References[edit] ^ "Computer Science Dictionary Definitions". Computing Studenta. Retrieved Jan 22, 2018.  ^ Felleisen, Matthias; Findler, Robert Bruce; Flatt, Matthew; and Krishnamurthi, Shriram; How To Design Programs, MIT Press, 2001 ^ Sebesta, Robert W. Concepts of Programming Languages (Third ed.). Addison-Wesley Publishing Company, Inc. p. 218. ISBN 0-8053-7133-8.  ^ Kraimer, Martin R. "EPICS Input / Output Controller (IOC) Application Developer's Guide". Argonne National Laboratory. Retrieved November 25, 2015.  v t e Data types Uninterpreted Bit Byte Trit Tryte Word Bit array Numeric Arbitrary-precision or bignum Complex Decimal Fixed point Floating point Double precision Extended precision Half precision Long double Minifloat Octuple precision Quadruple precision Single precision Integer signedness Interval Rational Pointer Address physical virtual Reference Text Character String null-terminated Composite Algebraic data type generalized Array Associative array Class Dependent Equality Inductive List Object metaobject Option type Product Record Set Union tagged Other Boolean Bottom type Collection Enumerated type Exception Function type Opaque data type Recursive data type Semaphore Stream Top type Type class Unit type Void Related topics Abstract data type Data structure Generic Kind metaclass Parametric polymorphism Primitive data type Protocol interface Subtyping Type constructor Type conversion Type system Type theory See also platform-dependent and independent units of information Retrieved from "https://en.wikipedia.org/w/index.php?title=Record_(computer_science)&oldid=825802731" Categories: Data typesComposite data typesHidden categories: Articles needing additional references from September 2009All articles needing additional referencesWikipedia articles needing page number citations from January 2012All articles with unsourced statementsArticles with unsourced statements from May 2009


Navigation menu Personal tools Not logged inTalkContributionsCreate accountLog in Namespaces ArticleTalk Variants Views ReadEditView history More Search Navigation Main pageContentsFeatured contentCurrent eventsRandom articleDonate to WikipediaWikipedia store Interaction HelpAbout WikipediaCommunity portalRecent changesContact page Tools What links hereRelated changesUpload fileSpecial pagesPermanent linkPage informationWikidata itemCite this page Print/export Create a bookDownload as PDFPrintable version Languages বাংলাČeštinaΕλληνικάEsperantoFrançaisBahasa IndonesiaItalianoNorskPortuguêsРусскийSuomiУкраїнська中文 Edit links This page was last edited on 15 February 2018, at 14:32. Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization. Privacy policy About Wikipedia Disclaimers Contact Wikipedia Developers Cookie statement Mobile view (window.RLQ=window.RLQ||[]).push(function(){mw.config.set({"wgPageParseReport":{"limitreport":{"cputime":"0.172","walltime":"0.229","ppvisitednodes":{"value":836,"limit":1000000},"ppgeneratednodes":{"value":0,"limit":1500000},"postexpandincludesize":{"value":30843,"limit":2097152},"templateargumentsize":{"value":1495,"limit":2097152},"expansiondepth":{"value":11,"limit":40},"expensivefunctioncount":{"value":3,"limit":500},"entityaccesscount":{"value":0,"limit":400},"timingprofile":["100.00% 183.701 1 -total"," 33.50% 61.531 1 Template:Reflist"," 31.81% 58.433 1 Template:Refimprove"," 22.38% 41.105 2 Template:Cite_web"," 20.87% 38.336 3 Template:Fix"," 17.69% 32.504 1 Template:Ambox"," 13.60% 24.976 1 Template:Page_needed"," 11.73% 21.546 3 Template:Delink"," 11.28% 20.730 2 Template:Citation_needed"," 7.14% 13.119 6 Template:Category_handler"]},"scribunto":{"limitreport-timeusage":{"value":"0.084","limit":"10.000"},"limitreport-memusage":{"value":2615170,"limit":52428800}},"cachereport":{"origin":"mw1326","timestamp":"20180217193825","ttl":1900800,"transientcontent":false}}});});(window.RLQ=window.RLQ||[]).push(function(){mw.config.set({"wgBackendResponseTime":72,"wgHostname":"mw1263"});});


Record_(computer_science) - Photos and All Basic Informations

Record_(computer_science) More Links

Wikipedia:VerifiabilityHelp:Introduction To Referencing With Wiki Markup/1Help:Maintenance Template RemovalComputer ScienceStruct (C Programming Language)Data StructureDatabaseSpreadsheetField (computer Science)Wikipedia:Citing SourcesObject-oriented ProgrammingCollection (abstract Data Type)Array Data TypeData TypeIdentifierType TheoryProduct TypeSystem F-subFirst-class FunctionObject-oriented ProgrammingMain MemoryMass Storage DevicesMagnetic TapeHard DiskLinked Data StructureComputer FileStorage RecordBlock (data Storage)SubroutineCall StackObject-orientedPlain Old Data StructureMathematicsTupleTupleCartesian ProductSet (mathematics)Product TypeIndexed FileEnlarge1880 United States CensusTable (information)LedgerAccountingCharles BabbageAnalytical EngineWikipedia:Citation NeededEnlargePunched CardPunch Card1890 United States CensusMachine LanguageAssembly LanguageIndex RegisterIndirect AddressingSelf-modifying CodeIBM 1620SortingTabulationIBM RPGCOBOLFORTRANFORTRAN IVAlgol 60Fortran 77Algol 68Lisp Programming LanguageCons CellS-expressionPascal Programming LanguagePL/IC (programming Language)Struct (C Programming Language)Ada (programming Language)ModulaJava Programming LanguageHash FunctionDebuggerGarbage Collection (computing)SerializationType PolymorphismComplex Data TypeCartesian CoordinatesBit StringShort IntegerLong IntegerCOBOLLexicographic OrderWikipedia:Citation NeededPL/IPascal Programming LanguageSystems ProgrammingFloating PointClass InheritanceGo (programming Language)Rust (programming Language)Haskell (programming Language)Block (data Storage)Composite Data TypeCons CellData HierarchyData Structure AlignmentObject CompositionRow (database)Storage RecordPassive Data StructureInternational Standard Book NumberSpecial:BookSources/0-8053-7133-8Template:Data TypesTemplate Talk:Data TypesData TypeUnits Of InformationBitByteTernary Numeral SystemTernary Numeral SystemWord (computer Architecture)Bit ArrayArbitrary-precision ArithmeticComplex Data TypeDecimal Data TypeFixed-point ArithmeticFloating PointDouble-precision Floating-point FormatExtended PrecisionHalf-precision Floating-point FormatLong DoubleMinifloatOctuple-precision Floating-point FormatQuadruple-precision Floating-point FormatSingle-precision Floating-point FormatInteger (computer Science)SignednessInterval ArithmeticRational Data TypePointer (computer Programming)Memory AddressPhysical AddressVirtual Address SpaceReference (computer Science)Plain TextCharacter (computing)String (computer Science)Null-terminated StringComposite Data TypeAlgebraic Data TypeGeneralized Algebraic Data TypeArray Data TypeAssociative ArrayClass (computer Programming)Dependent TypeIntuitionistic Type TheoryInductive TypeList (abstract Data Type)Object (computer Science)MetaobjectOption TypeProduct TypeSet (abstract Data Type)Union TypeTagged UnionBoolean Data TypeBottom TypeContainer (abstract Data Type)Enumerated TypeException HandlingFunction TypeOpaque Data TypeRecursive Data TypeSemaphore (programming)Stream (computing)Top TypeType ClassUnit TypeVoid TypeAbstract Data TypeData StructureGeneric ProgrammingKind (type Theory)MetaclassParametric PolymorphismPrimitive Data TypeProtocol (object-oriented Programming)Interface (computing)SubtypingType ConstructorType ConversionType SystemType TheoryTemplate:Information UnitsHelp:CategoryCategory:Data TypesCategory:Composite Data TypesCategory:Articles Needing Additional References From September 2009Category:All Articles Needing Additional ReferencesCategory:Wikipedia Articles Needing Page Number Citations From January 2012Category:All Articles With Unsourced StatementsCategory:Articles With Unsourced Statements From May 2009Discussion About Edits From This IP Address [n]A List Of Edits Made From This IP Address [y]View The Content Page [c]Discussion About The Content Page [t]Edit This Page [e]Visit The Main Page [z]Guides To Browsing WikipediaFeatured Content – The Best Of WikipediaFind Background Information On Current EventsLoad A Random Article [x]Guidance On How To Use And Edit WikipediaFind Out About WikipediaAbout The Project, What You Can Do, Where To Find ThingsA List Of Recent Changes In The Wiki [r]List Of All English Wikipedia Pages Containing Links To This Page [j]Recent Changes In Pages Linked From This Page [k]Upload Files [u]A List Of All Special Pages [q]Wikipedia:AboutWikipedia:General Disclaimer



view link view link view link view link view link