Defining Data Structure Parameters in a Prototype or Procedure Interface

To define a prototyped parameter as a data structure, you must first define the layout of the parameter by defining an ordinary data structure. Then, you can define a prototyped parameter as a data structure by using the LIKEDS keyword. To use the subfields of the parameter, specify the subfields qualified with parameter name: dsparm.subfield. For example

  * PartInfo is a data structure describing a part.
 D  PartInfo       DS                   QUALIFIED
 D  Manufactr                     4
 D  Drug                          6
 D  Strength                      3
 D  Count                         3  0
  * Procedure "Proc" has a parameter "Part" that is a data 
  * structure whose subfields are the same as the subfields
  * in "PartInfo".  When calling this procedure, it is best
  * to pass a parameter that is also defined LIKEDS(PartInfo)
  * (or pass "PartInfo" itself), but the compiler will allow
  * you to pass any character field that has the correct
  * length.
 D Proc            PR
 D  Part                                LIKEDS(PartInfo)
 P Proc            B
  * The procedure interface also defines the parameter Part
  * with keyword LIKEDS(PartInfo).
  * This means the parameter is a data structure, and the subfields
  * can be used by specifying them qualified with "Part.", for
  * example "Part.Strength"
 D Proc            PI
 D  Part                                LIKEDS(PartInfo)
 C                   IF        Part.Strength > getMaxStrength (Part.Drug)
 C                   CALLP     PartError (Part : DRUG_STRENGTH_ERROR)
 C                   ELSE
 C                   EVAL      Part.Count = Part.Count + 1
 C                   ENDIF
 P Proc            E


[ Top of Page | Previous Page | Next Page | Contents | Index ]