MASTER  FILE  DESCRIPTION
 INTRODUCTION
  THREE PRIMARY ATTRIBUTES of an MFD
1. FILE ATTRIBUTE
          2. SEGMENT ATTRIBUTE
3. FIELD ATTRIBUTE
DATE  FORMAT
OPTIONAL  ATTRIBUTES  IN  MFD
CHARACTERISTICS OF  A  MFD
 INTRODUCTION
   This chapter deals with how to describe a   File to Focus  so that it can  use the
  description  while processing a report request.

 As Focus can report both from its own database as well as from an external database , there   must  be a  description for Focus  that tells it of  the  nature of File (Fixed or Variable ) ,the  Record names, the  Field names,  and the  nature of the field ( Alpha Numeric, Integer , Packed etc..).

This description is stored in a separate file called a MASTER. In Mainframe Focus, there is an separate PDS  where each member is a MFD. Each of which  describes a particular file.

Generally the PDS is coded as  **. MASTER. **   .

Let us learn on the characteristics of Master through this sample Master.

FILE=MAST, SUFFIX=FIX,
SEGNAME=EMPLOYEE,   ( ==> similar to a Record of IDMS.   )
FIELD = EMPLOYEE_ID , ALIAS= EID     ,  USAGE= I9, ACTUAL = I9  , $
FIELD = LAST_NAME     , ALIAS= LN     ,   USAGE= A10, ACTUAL = A10 , $
FIELD = FIRST_NAME    , ALIAS= FN      ,   USAGE= A15, ACTUAL = A15 , $
FIELD = DEPARTMENT  , ALIAS= DEPT. ,  USAGE= D9.2, ACTUAL = D9,$

SEGNAME = PRSNL_INFO, SEGTYPE = S1,PARENT = EMPLOYEE  ( ==> owner )
FIELD = SPOUSE_NAME,   ALIAS = SN,      USAGE = A25, ACTUAL = A25,$
FIELD = CHILDREN,           ,                          USAGE = I2,   ACTUAL = I2,$
 

THE MFD HAS THREE PRIMARY ATTRIBUTES
· FILE ATTRIBUTE
· SEGMENT ATTRIBUTE
· FIELD ATTRIBUTE
 

 FILE ATTRIBUTES :
  The  FILE = <file name > specifies the name of the file . In case of   Mainframe Focus, the
  member   name corresponds to the file name. ( Note :-- this is strictly not true but enough for our
  purpose ).
 
The SUFFIX= specifies the type of the file to Focus. For a focus file it is FOC
  for an external fixed formatted file it is FIX .   For  an IDMS database it is  IDMSR.
SEGMENT  ATTRIBUTES
 
                    The   SEGMENT = specifies the segment name.
  The  structure of an  Focus database is  Hierarchical .     So there can only be one Root segment, all others are  descendants  of it.
     RULES THAT GOVERN THE  SEGMENT ATTRIBUTES.
 
· The first field of a segment must always have  unique  occurrences  of   a  value. E.g., SSN number.
· The  occurrences of the  segment are automatically  sorted in an ascending order  of  the
  first field .
· In case more than one field is desired   to be placed as the  sort key,  it  is  described as
  SEGTYPE = S2.
 In this case  the  first two  fields  are used for  sorting.
· In case   the  occurrences are to be sorted in  an  descending order, it is specified as
                SEGTYPE = SH2,
    In which case  the segment occurrences are  sorted and stored in an descending order
         of   the  values of the  first two fields.
· SEGTYPE = S0   Is valid . This and SEGTYPE=,, (No Type specification  both are treated as that segment has no Key Fields).
· SEGTYPE = S0 Can be  a  Root segment whereas  SEGTYPE=,, cannot be .
· SEGTYPE=,, is called as type blank segment.
· There are finer  differences between these two types which will be discussed subsequently.
· SEGTYPE = U .     This defines a unique segment.   This  is a child of the parent  as defined in the MFD. However  when this type is defined, There is only one occurrence of the child for every  occurrence of  the parent  .  This  child  segment is treated as  if  it was a  logical continuation of  the  parent.
 
· The PARENT=   specifies the parent segment for  the  segment. In case this is omitted, the
   Parent  defaults to  the previous segment.
· Only the  first  field  (ROOT SEGMENT)  Can  be without  any  parent.
· The segment name can be up to 8 characters long and  of  alphabetic characters A-Z.
  THE  FIELD ATTRIBUTES
 
· FIELD =  identifies the  field  name to Focus.
· The field name can be any alpha numeric character, but must begin with a  Alphabet.
· ALIAS= is optional, and is similar to Synonym  of an  field name in IDMS.
· This  ALIAS can be used in the  FOCEXEC instead of the (generally)  lengthy field names.
· If an  alias is not defined then in the MFD, two commas must precede  the  USAGE= attribute.
· The  USAGE = attribute  is  to describe to Focus  how to display that particular  data  in report
    requests.
· The  USAGE = <format> consists of three  parts.
· 1.  Field type
· 2.  Field Length
· 3.  Edit options.
· USAGE = A6MDY   ,   USAGE = I6
·  Field type as in  A, I, this is used to indicate the  nature of the field such as  Integer (I),
                 Alphanumeric (A) , etc....
· The  field length is specified by   A6 ,  I9, etc....   note there are restrictions on the maximum  length of the field for  each  Field  type ,e.g.,  for Integer type it is 9.
· Edit options.  the USAGE = A6MDY   ,   USAGE = I6E  .Here the  MDY tell Focus that  it is a date  field , Focus when displaying this field automatically  inserts  ‘/’ as  98/02/26  when it  reads   980226 from the data base
· Other edit options are  as ‘ L ‘ for  inserting   leading   zeroes   etc...
 Date  Format.

·   Focus has a extensive date format.  A date in the YMD format can be
     displayed   as  DMY format  in the report just by changing the edit option of the field that is used  to display it to  NEW_DATE/A6MDYY= This will cause a date like 980227 to be displayed as 02/27/1998
· Other  date conversions include  displaying a date as  Monday , December 30 1985,
· This would involve defining the date format to  /A6MtrDYY.
· Actual Attribute.
· This describes the type of data as it actually exists in the data base or file. The source of this
  information is the cobol FD statements. This ACTUAL= exists in the MFD only when describing
  an external data to FOCUS, Focus data bases do not need it.
 
    There is an exclusive section for dates in FOCUS

 OPTIONAL  ATTRIBUTES  IN  MFD.

1.   Description attribute.   It is used to include  a descriptive text for a field, and is ignored while
 processing.   Up to 44  characters can be included in this.
E.g..   FIELD=UNITS,,USAGE=I6,ACTUAL=I6,
  DESC==‘QUANTITY SOLD’, $
2.  Title attribute.   Is used to supply an optional Column title  instead of the field name.
E.g..   FIELD=DOB,,USAGE=I6YMD,ACTUAL=I6,
  TITLE= ‘ Date  of  Birth’, $
3.    Missing attribute.    The default is  OFF, if set to  ON, Focus will distinguish a missing value
   from an internally entered blank or  Zero. This is useful in reports where Counts or  Averages are done.
 When Missing is set to ON, and a count is done,  all missing fields are excluded, similarly with  the case of Averages.
4.     Field Type attribute.
 Eg.  FIELD=EMPLOYEE_ID,,USAGE=A6YMD,ACTUAL=A6,FIELDTYPE=I,$
 
 This is used to create an index for a Field in a file. Note : Text fields cannot be
INDEXED , (i.e., FIELDS with USAGE=TX)

It is an internally stored and maintained table of values and the locations of these ,and  helps in
   retrieval.

An index is mandatory if
1. A segment is to be cross referenced, esp by JOINS,
2. Create certain alternate view files
3. Use a  FIND function in MODIFY
4. Speed  up  retrieval for a given field.
 
5.   HELP MESSAGE ATTRIBUTE :
 
 E.g..  FIELD = EMPLOYEE_ID,,USAGE = A6YMD, ACTUAL = A6,
   HELPMESSAGE=‘ XXXXX ....TEXT.... XXXXX’ ,$
Text is one line with up to 78 characters long.
This text is displayed in the type area of  MODIFY or  CRTFORM .  This could also be used to  specify acceptable values  for the fields.

6.  OCCURS  ATTRIBUTE  :
 Eg.     OCCURS =  n
                              field name
                              variable.
 If  it  is    ‘n’   then ‘n’   describes  the  number of times that  field  occurs.
 
 If  field name,  it  names  data set  in the parent segment  that is  a counter  containing  the number
 of  occurrences  of  the descendent  segments.  ( Similar  to COBOL's occurs  depending on ..)
 
 If  variable,  it indicates to Focus that the number of occurrences varies from record to record,
 and  Focus computes the number of occurrences from  the  field length.

 In the MFD  the  entry for this would be as
 SEGNAME=TWO,PARENT=ONE,OCCURS=2,$

7.  POSITION ATTRIBUTE :
 It   is  used  to  describe  a structure    in which a  multiple  number  of   occurrences  of a field
 occur  in the middle of a   record.
 

 CHARACTERISTICS OF  A  MFD

 1.     For Mainframe , the MFD must be always be  80 characters long.
 2.     All  must be in capitals,  except the contents of TITLE and DESC attributes.
 3.      The contents of an  single specification can spill over to as many lines and is ended by the
           delimiter  ‘ $ ‘.
 
Click here  to learn on the basic verbs used in FOCUS