プロトタイプまたはプロシージャー・インターフェースにおけるデータ構造パラメーターの定義

プロトタイプされたパラメーターをデータ構造として定義するには、まず通常のデータ構造を定義することによってパラメーターのレイアウトを定義する必要があります。 その後で、プロトタイプされたパラメーターを、LIKEDS キーワードを使ってデータ構造として定義することができます。 パラメーターのサブフィールドを使用するには、そのサブフィールドを「パラメーター名.サブフィールド」のようにパラメーター名で修飾して指定します。 たとえば

  * 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