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$O9`L\D9$G$"$k!#(B (3) $BF~NO9`L\$O!$(B(2)$B$N(Biro-name$B$NCM$,6uGr$N>l9g$OCl9g$O@V$GI=<($5$l$k!#=PNO9`L\$O!$Cl9g$O!$F~NO;~$K>e0L$1$?$N(B0$B$O>JN,$G$-$k!#F~NO;~$K(Bscreen $BCf$G>e0L$1$?$N(B0$B$,Jd$o$l!$$1$?6h@Z$j$N%3%s%^$,:o=|$5$l$k!#I=<(;~$K(B $B>e0L$1$?$N(B0$B$O6uGr$GCV$-49$($i$l!$(B3$B$1$?6h@Z$j$G%3%s%^$,A^F~$5$l$k!#(B 4. $B3+;OF|$NF|IU$NBEEv@-%A%'%C%/$O!$I{%W%m%0%i%`(Bdcheck$B$rMQ$$$k!#$3$N(B $BI{%W%m%0%i%`$NBh(B1$B0z?t$O3+;OF|!$Bh(B2$B0z?t$O%A%'%C%/7k2L$G$"$j!$FbMF$,(B $BBEEv$J$i$P6uGr!$BEEv$G$J$1$l$P(B"E"$B$,@_Dj$5$l$k!#(B 5. $B?M;v%U%!%$%k(B($B:w0z%U%!%$%k!$%-!<$O!$=IGq
$B6$B$1$?(B$B;aL>(B
20$B$1$?(B
$B=IGq6$B$1$?(B$BF|Ev(B
6$B$1$?(B
$B$=$NB>(B
33$B$1$?(B
 6.  $B=PD%N9Hq$N9g7W6b3[$O!$
$B(#!!!!!!!!:w0z%-!
$B6$B$1$?(B $B3+;OF|(B
8$B$1$?(B
$B$=$NB>$N9`L\(B
108$B$1$?(B
[$B%W%m%0%i%`(B]

  data division.
  file section.
  fd  jinji-file.
  01  j-rec.
    05  j-shain-code            pic x(6).  
    05  j-shimei		pic x(20). 
    05  j-shukuhaku-teate	pic 9(6).  
    05  j-nitto			pic 9(6).  
    05  j-sonota		pic x(33).
  fd shuccho-ryohi-file.
  01  s-rec.
    05  s-index-key.
      10  s-shain-code          pic x(6).
      10  s-kaishi-bi		pic x(8).
    05  s-shimei             	pic x(20). 
    05	s-shukuhaku-nissu    	pic 9(2).
    05	s-shuccho-nissu      	pic 9(2).
    05	s-mokuteki           	pic x(60). 
    05	s-kotsu-hi          	pic 9(6).
    05	s-shukuhaku-teate-kei	pic 9(6).
    05	s-nitto-kei          	pic 9(6).
    05	s-gokei-kingaku      	pic 9(6).
  working-storage section.
  01  ryohi-gamen.
    05  r-message               pic x(60).
    05	iro-shain-code        	pic x(1). 
    05	r-shain-code          	pic x(6). 
    05	r-shimei              	pic x(20).
    05	iro-kaishi-bi         	pic x(1). 
    05	r-kaishi-bi           	pic x(8). 
    05	iro-shukuhaku-nissu   	pic x(1). 
    05	r-shukuhaku-nissu     	pic 9(2). 
    05	iro-shuccho-nissu     	pic x(1). 
    05	r-shuccho-nissu       	pic 9(2). 
    05	iro-mokuteki         	pic x(1). 
    05	r-mokuteki            	pic x(60).
    05	iro-kotsu-hi            pic x(1). 
    05	r-kotsu-hi              pic 9(6). 
    05	r-shukuhaku-teate-kei 	pic 9(6). 
    05	r-nitto-kei           	pic 9(6). 
    05	r-gokei-kingaku       	pic 9(6). 
    05	r-tsugi-no-shori      	pic x(1). 
    05	r-bango               	pic x(40).
  01  gamen-mei       		pic x(20).
  01  error-ind   		pic x(1). 
  01  check-kekka 		pic x(1). 
  01  message1   		pic x(60)   value
      "$B=PD%>pJs$rF~%+$7$F$/$@$5$$!#(B".
  01  message2                  pic x(60)   value
      "$B8m$j$rD{@5$7$F$/$@$5$$!#(B".
  01  message3                  pic x(60)   value
      "$BN9Hq$r7W;;$7$^$7$?!#FbMF$r3NG'$7$F$/$@$5$$!#(B".
  01  message4                  pic x(60)   value
      "$BF10lF|$G=PD%N9Hq7W;;:Q$_$G$9!#8m$j$rD{@5$7$F$/$@$5$$!#(B".
  01  bango1 pic x(40) va1ue  "1 ($B=*N;(B) $B!$(B2 ($BN9Hq7W;;(B)". 
  01  bango2 pic x(40)                                
                value    "1 ($B=*N;(B) $B!$(B2 ($B>5G'(B) $B!$(B3 ($BD{@5(B) ".
  procedure division.
  P1. open input jinji-file i-o shuccho-ryohi-file.
  P2. move space to ryohi-gamen.
      move message1 to r-message.
  P3. move "2" to r-tsugi-no-shori.
      move bango1 to r-bango.
      move "shoki-teisei$B!I(Bto gamen-mei.
      call "screen$B!I(Busing gamen-mei ryohi-gamen.
      if r-tsugi-no-shori = "1"
        go to P4.
      move space to error-ind.
      move [   a   ] to iro-shain-code      iro-kaishi-bi
                        iro-shukuhaku-nissu iro-shuccho-nissu
                        iro-mokuteki        iro-kotsu-hi.
      move r-shain-code to j-shain-code.
      read jinji-file
        [   b   ]     move "R" to error-ind iro-shain-code
                      move space to r-shimei
        not [   b   ] move j-shimei to r-shimei 
      end-read.
      call "dcheck" using r-kaishi-bi check-kekka.
      if check-kekka = "E"
        move "R" to error-ind iro-kaishi-bi.
      if r-shukuhaku-nissu is not numeric
        move "R" to error-ind iro-shukuhaku-nissu.
      if r-shuccho-nissu is not numeric
        move "R" to error-ind iro-shuccho-nissu.
      if r-mokuteki = space
        move "R" to error-ind iro-mokuteki.
      if r-kotsu-hi is not numeric
        move "R" to error-ind iro-kotsu-hi.
      if error-ind = "R"
        move [   c   ] to r-message
        go to P3.
      compute r-shukuhaku-teate-kei = j-shukuhaku-teate  *
                                     r-shukuhaku-nissu.
      compute r-nitto-kei = j-nitto * r-shuccho-nissu.
      compute r-gokei-kingaku = r-kotsu-hi +
                         r-shukuhaku-teate-kei + r-nitto-kei.
      move message3 to r-message.
      move bango2 to r-bango.
      move "2" to r-tsugi-no-shori.
      move "kekka" to gamen-mei.
      call "screen" using gamen-mei ryohi-gamen.
      evaluate r-tsugi-no-shori
        when   "1"   go to p4
        when   "2"
	  move r-shain-code          to s-shain-code      
	  move r-kaishi-bi	     to s-kaishi-bi       
	  move r-shimei		     to s-shimei          
	  move r-shukuhaku-nissu     to s-shukuhaku-nissu 
	  move r-shuccho-nissu	     to s-shuccho-nissu  
	  move r-mokuteki            to s-mokuteki
	  move r-kotsu-hi            to s-kotsu-hi
	  move r-shukuhaku-teate-kei to s-shukuhaku-teate-kei
	  move r-nitto-kei           to s-nitto-kei
	  move r-gokei-kingaku       to s-gokei-kingaku
          write s-rec
            invalid key move "R" to iro-shain-code iro-kaishi-bi
                        move [   d   ] to r-message   
                        go to p3
            not inva1id key go to p2
          end-write 
        when [   e   ] go to p3
      end-evaluate.
  P4. close jinji-file shuccho-ryohi-file
      stop run.

$B@_Ld(B $B%W%m%0%i%`Cf$N(B[      ]$B$KF~$l$k@5$7$$Ez$($r!$2rEz72$NCf$+$iA*%Y!#(B

a$B!$(Bc$B!$(Bd$B$K4X$9$k2rEz72(B

  $B%"(B  "E"              $B%$(B  high-value        $B%&(B  low-value

  $B%((B  message1	       $B%*(B  message2          $B%+(B  message3  

  $B%-(B  message4	       $B%/(B  "R"       	     $B%1(B  space      
b$B!$(Be$B$K4X$9$k2rEz72(B $B%"(B another $B%$(B at end $B%&(B "E" $B%((B error key $B%*(B invalid key $B%+(B on error $B%-(B on exception $B%/(B other $B%1(B "3"

$BLa$k(B $B