FMD
Retrieves a Portion of the Data Area of a Format
This string function returns the data area or a specified portion of the data area of a format currently in memory.
Syntax
Section titled “Syntax”FMD( string-value [ ,element-number] [, occurrence-number] ][,ERR=line-ref|,ERC=error-code])string-value- is any string that contains a format name or data name.
element-number- is a positive integer that specifies the data element to be referenced. The element-number must be 0 if a data name is specified.
occurrence-number- is a positive integer that specifies the occurrence of a data element.
line-ref- is the program line number or label to branch to if an error is produced.
error-code- is a programmer-defined error code. Valid values are positive or negative whole numbers.
Remarks
Section titled “Remarks”The capability of specifying a data name is generally available starting with release 8.3.0.
Starting with release 8.2.2, specifying a zero for the occurrence-value of a data element defined to have multiple occurrences will return the data for all occurrences of the data element.
An attempt to reference an invalid format/data name results in an ERR=17.
An attempt to reference a data name with a data element number results in an ERR=17.
An attempt to reference a format name that is not recognized by the data dictionary or the current program results in an ERR=161.
An attempt to reference a data name that does not exist in the format’s data element table results in an ERR=163.
An attempt to reference an occurrence number of an element that is defined to not have multiple occurrences results in an ERR=164.
An attempt to reference an invalid occurrence number of an element that is defined to have multiple occurrences results in an ERR=165.
Examples
Section titled “Examples”F$="#DNFFMT";LET D$=FMD(F$)D$ receives the data area of the format #DNFFMT.
LET X$ = FMD (F$,2)X$ receives the value of the second data element defined in the format #DNFFMT.
LET Y$ = FMD (F$,3,4)Y$ receives the value of the fourth occurrence of the third data element defined in the format #DNFFMT.
Z$=FMD(F$,3,0)Z$ receives the values of all occurrences of the third data element defined in format #DNFFMT.
See also
Section titled “See also”LET FMD directive
ATR function
From the Thoroughbred Basic Language Reference, Volume II: F–Q, version 8.9.1. Open this page in the PDF