Rational Developer for System z
PL/I for Windows, Version 8.0, プログラミング・ガイド

REGIONAL(1) データ・セットの作成例が、図 16 に示し てあります。この例のデータ・セットは、内線電話番号とその電話番号を割り当てる加入者の氏名のリストです。内線電話番号は領域データ・セット内の領域番号と対応しており、各領域番号が占め る領域には加入者名のデータが入っています。

図 16. REGIONAL(1) データ・セットの作成
 /********************************************************************/
 /*                                                                  */
 /*  DESCRIPTION                                                     */
 /*    Create a REGIONAL(1) data set.                                */
 /*                                                                  */
 /*  USAGE                                                           */
 /*    The following commands are required to establish              */
 /*    the environment variables to run this program:                */
 /*                                                                  */
 /*     SET DD:SYSIN=CRG.INP,RECSIZE(30)                             */
 /*     SET DD:NOS=NOS.DAT,RECCOUNT(100)                             */
 /*                                                                  */
 /********************************************************************/

  CRR1: proc options(main);

    dcl  Nos file record output direct keyed
         env(regional(1) recsize(20));

    dcl  Sysin file input record;
    dcl 1   In_Area,
         2   Name   char(20),
         2   Number char( 2);
    dcl IoField char(20);
    dcl Sysin_Eof bit (1) init('0'b);
    dcl Ntemp fixed(15);
    on endfile (Sysin) Sysin_Eof = '1'b;
    open file(Nos);
    read file(Sysin) into(In_Area);
    do while(¬Sysin_Eof);
       IoField = Name;
       Ntemp = Number;
       write file(Nos) from(IoField) keyfrom(Ntemp);
       put file(sysprint) skip edit (In_Area) (a);
       read file(Sysin) into(In_Area);
    end;
     close file(Nos);
  end CRR1;
The execution time input file, CRG.INP, might look like this:

ACTION,G.           12
BAKER,R.            13
BRAMLEY,O.H.        28
CHEESNAME,L.        11
CORY,G.             36
ELLIOTT,D.          85
FIGGINS,E.S.        43
HARVEY,C.D.W.       25
HASTINGS,G.M.       31
KENDALL,J.G.        24
LANCASTER,W.R.      64
MILES,R.            23
NEWMAN,M.W.         40
PITT,W.H.           55
ROLF,D.E.           14
SHEERS,C.D.         21
SURCLIFFE,M.        42
TAYLOR,G.C.         47
WILTON,L.W.         44
WINSTONE,E.M.       37

Terms of use | Feedback

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