Rational Developer for System z
Enterprise PL/I for z/OS, Version 3.8, 言語解説書

  dcl Source char value(' Our PL/I wields the Power ');
  dcl Pos fixed bin(31);

/* Find occurrences of any of the characters 'P','o',or 'w' in source *  /

  Pos = search (Source, 'Pow');              /*  returns 6 for the 'P'    */
  Pos = search (Source, 'Pow', Pos+1);    /*  returns 11 for the 'w'   */
  Pos = search (Source, 'Pow', Pos+1);    /*  returns 22 for the 'P'   */
  Pos = search (Source, 'Pow', Pos+1);    /*  returns 23 for the 'o'   */
  Pos = search (Source, 'Pow', Pos+1);    /*  returns 24 for the 'w'   */

  Pos = index (source, 'Pow',1);             /*  returns 22 for the 'Pow' */

上記の例では、SEARCH は 3 文字 (P, o, または w) のどれかが表れる位置 を戻します。 INDEX はストリング Pow が表れる位置を戻します。


Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)