program-id. a720-trideni-cestiny-utf-8. *> vstupem jsou řádky Stdin, ukončené "Enter" *> transformaci přes 1-bytový kód KW lze využít i v indexových souborech *> limit umožňuje definovat maximálně asi 80 řádků vstupních dat environment division. input-output section. file-control. select TRIDENI assign disk. data division. file section. sd TRIDENI. 1 RADEK pic x(80). working-storage section. 77 T pic 9. 88 PRACE value 0. 88 KONEC value 1. 77 I pic 999. 77 J pic 999. 77 K pic 9. 88 UW value 1. 88 WU value 2. 77 TX pic 999. 1 KW. 2 pic x(20) value x"a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7". 2 pic x(20) value x"b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacb". 2 pic x(20) value x"cccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedf". 2 pic x(20) value x"e0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3". 2 pic x(4) value x"f4f5f6f7". 1 KW-H redefines KW. 2 H pic x occurs 84. 1 ZA. 2 A pic x occurs 80. 1 ZB. 2 B pic x occurs 80. procedure division. display "----- TŘÍDĚNÍ" sort TRIDENI ascending RADEK input procedure VSTUP output procedure VYSTUP display "----- KONEC" stop run. VSTUP. set UW to true set PRACE to true perform until KONEC accept RADEK if RADEK = space set KONEC to true else move RADEK to ZA perform UPRAVA release RADEK from ZB end-if end-perform. VYSTUP. set WU to true set PRACE to true perform until KONEC return TRIDENI end set KONEC to true not end move RADEK to ZA perform UPRAVA display ZB end-return end-perform. UPRAVA. initialize TX ZB inspect ZA tallying TX for trailing space compute TX = 80 - TX move 1 to I J perform until I > TX evaluate true when UW perform UPRAVA-UW when WU perform UPRAVA-WU when other display "chyba programu !!!" end-evaluate end-perform. UPRAVA-UW. evaluate true *> CH 27 Ch 28 cH 29 ch 30 *> x"4348" x"4368" x"6348" x"6368" when A(I) = "C" and A(I + 1) = "H" move H(27) to B(J) add 2 to I add 1 to J when A(I) = "C" and A(I + 1) = "h" move H(28) to B(J) add 2 to I add 1 to J when A(I) = "c" and A(I + 1) = "H" move H(29) to B(J) add 2 to I add 1 to J when A(I) = "c" and A(I + 1) = "h" move H(30) to B(J) add 2 to I add 1 to J *> A 1 a 2 Á 3 á 4 B 5 b 6 C 7 c 8 Č 9 č 10 *> x"41" x"61" x"c381" x"c3a1" x"42" x"62" x"43" x"63" x"c48c" x"c48d" when A(I) = "A" move H(1) to B(J) add 1 to I J when A(I) = "a" move H(2) to B(J) add 1 to I J when A(I) = x"c3" and A(I + 1) = x"81" move H(3) to B(J) add 2 to I add 1 to J when A(I) = x"c3" and A(I + 1) = x"a1" move H(4) to B(J) add 2 to I add 1 to J when A(I) = "B" move H(5) to B(J) add 1 to I J when A(I) = "b" move H(6) to B(J) add 1 to I J when A(I) = "C" move H(7) to B(J) add 1 to I J when A(I) = "c" move H(8) to B(J) add 1 to I J when A(I) = x"c4" and A(I + 1) = x"8c" move H(9) to B(J) add 2 to I add 1 to J when A(I) = x"c4" and A(I + 1) = x"8d" move H(10) to B(J) add 2 to I add 1 to J *> D 11 d 12 Ď 13 ď 14 E 15 e 16 É 17 é 18 Ě 19 ě 20 *> x"44" x"64" x"c48e" x"c48f" x"45" x"65" x"c389" x"c3a9" x"c49a" x"c49b" when A(I) = "D" move H(11) to B(J) add 1 to I J when A(I) = "d" move H(12) to B(J) add 1 to I J when A(I) = x"c4" and A(I + 1) = x"8e" move H(13) to B(J) add 2 to I add 1 to J when A(I) = x"c4" and A(I + 1) = x"8f" move H(14) to B(J) add 2 to I add 1 to J when A(I) = "E" move H(15) to B(J) add 1 to I J when A(I) = "e" move H(16) to B(J) add 1 to I J when A(I) = x"c3" and A(I + 1) = x"89" move H(17) to B(J) add 2 to I add 1 to J when A(I) = x"c3" and A(I + 1) = x"a9" move H(18) to B(J) add 2 to I add 1 to J when A(I) = x"c4" and A(I + 1) = x"9a" move H(19) to B(J) add 2 to I add 1 to J when A(I) = x"c4" and A(I + 1) = x"9b" move H(20) to B(J) add 2 to I add 1 to J *> F 21 f 22 G 23 g 24 H 25 h 26 - - - - CH 27, Ch 28, cH 29, ch 30 - viz nahoře *> x"46" x"66" x"47" x"67" x"48" x"68" when A(I) = "F" move H(21) to B(J) add 1 to I J when A(I) = "f" move H(22) to B(J) add 1 to I J when A(I) = "G" move H(23) to B(J) add 1 to I J when A(I) = "g" move H(24) to B(J) add 1 to I J when A(I) = "H" move H(25) to B(J) add 1 to I J when A(I) = "h" move H(26) to B(J) add 1 to I J *> I 31 i 32 Í 33 í 34 J 35 j 36 K 37 k 38 L 39 l 40 *> x"49" x"69" x"c38d" x"c3ad" x"4a" x"6a" x"4b" x"6b" x"4c" x"6c" when A(I) = "I" move H(31) to B(J) add 1 to I J when A(I) = "i" move H(32) to B(J) add 1 to I J when A(I) = x"c3" and A(I + 1) = x"8d" move H(33) to B(J) add 2 to I add 1 to J when A(I) = x"c3" and A(I + 1) = x"ad" move H(34) to B(J) add 2 to I add 1 to J when A(I) = "J" move H(35) to B(J) add 1 to I J when A(I) = "j" move H(36) to B(J) add 1 to I J when A(I) = "K" move H(37) to B(J) add 1 to I J when A(I) = "k" move H(38) to B(J) add 1 to I J when A(I) = "L" move H(39) to B(J) add 1 to I J when A(I) = "l" move H(40) to B(J) add 1 to I J *> M 41 m 42 N 43 n 44 O 45 o 46 Ó 47 ó 48 P 49 p 50 *> x"4d" x"6d" x"4e" x"6e" x"4f" x"6f" x"c393" x"c3b3" x"50" x"70" when A(I) = "M" move H(41) to B(J) add 1 to I J when A(I) = "m" move H(42) to B(J) add 1 to I J when A(I) = "N" move H(43) to B(J) add 1 to I J when A(I) = "n" move H(44) to B(J) add 1 to I J when A(I) = "O" move H(45) to B(J) add 1 to I J when A(I) = "o" move H(46) to B(J) add 1 to I J when A(I) = x"c3" and A(I + 1) = x"93" move H(47) to B(J) add 2 to I add 1 to J when A(I) = x"c3" and A(I + 1) = x"b3" move H(48) to B(J) add 2 to I add 1 to J when A(I) = "P" move H(49) to B(J) add 1 to I J when A(I) = "p" move H(50) to B(J) add 1 to I J *> Q 51 q 52 R 53 r 54 Ř 55 ř 56 S 57 s 58 Š 59 š 60 *> x"51" x"71" x"52" x"72" x"c598" x"c599" x"53" x"73" x"c5a0" x"c5a1" when A(I) = "q" move H(52) to B(J) add 1 to I J when A(I) = "R" move H(53) to B(J) add 1 to I J when A(I) = "Q" move H(51) to B(J) add 1 to I J when A(I) = "r" move H(54) to B(J) add 1 to I J when A(I) = x"c5" and A(I + 1) = x"98" move H(55) to B(J) add 2 to I add 1 to J when A(I) = x"c5" and A(I + 1) = x"99" move H(56) to B(J) add 2 to I add 1 to J when A(I) = "S" move H(57) to B(J) add 1 to I J when A(I) = "s" move H(58) to B(J) add 1 to I J when A(I) = x"c5" and A(I + 1) = x"a0" move H(59) to B(J) add 2 to I add 1 to J when A(I) = x"c5" and A(I + 1) = x"a1" move H(60) to B(J) add 2 to I add 1 to J *> T 61 t 62 Ť 63 ť 64 U 65 u 66 Ú 67 ú 68 Ǔ 69 ů 70 *> x"54" x"74" x"c5a4" x"c5a5" x"55" x"75" x"c39a" x"c3ba" x"c793" x"c5af" when A(I) = "T" move H(61) to B(J) add 1 to I J when A(I) = "t" move H(62) to B(J) add 1 to I J when A(I) = x"c5" and A(I + 1) = x"a4" move H(63) to B(J) add 2 to I add 1 to J when A(I) = x"c5" and A(I + 1) = x"a5" move H(64) to B(J) add 2 to I add 1 to J when A(I) = "U" move H(65) to B(J) add 1 to I J when A(I) = "u" move H(66) to B(J) add 1 to I J when A(I) = x"c3" and A(I + 1) = x"9a" move H(67) to B(J) add 2 to I add 1 to J when A(I) = x"c3" and A(I + 1) = x"ba" move H(68) to B(J) add 2 to I add 1 to J when A(I) = x"c7" and A(I + 1) = x"93" move H(69) to B(J) add 2 to I add 1 to J when A(I) = x"c5" and A(I + 1) = x"af" move H(70) to B(J) add 2 to I add 1 to J *> V 71 v 72 W 73 w 74 X 75 x 76 Y 77 y 78 Ý 79 ý 80 *> x"56" x"76" x"57" x"77" x"58" x"78" x"59" x"79" x"c39d" x"c3bd" when A(I) = "V" move H(71) to B(J) add 1 to I J when A(I) = "v" move H(72) to B(J) add 1 to I J when A(I) = "W" move H(73) to B(J) add 1 to I J when A(I) = "w" move H(74) to B(J) add 1 to I J when A(I) = "X" move H(75) to B(J) add 1 to I J when A(I) = "x" move H(76) to B(J) add 1 to I J when A(I) = "Y" move H(77) to B(J) add 1 to I J when A(I) = "y" move H(78) to B(J) add 1 to I J when A(I) = x"c3" and A(I + 1) = x"9d" move H(79) to B(J) add 2 to I add 1 to J when A(I) = x"c3" and A(I + 1) = x"bd" move H(80) to B(J) add 2 to I add 1 to J *> Z 81 z 82 Ž 83 ž 84 *> x"5a" x"7a" x"c5bd" x"c5be" when A(I) = "Z" move H(81) to B(J) add 1 to I J when A(I) = "z" move H(82) to B(J) add 1 to I J when A(I) = x"c5" and A(I + 1) = x"bd" move H(83) to B(J) add 2 to I add 1 to J when A(I) = x"c5" and A(I + 1) = x"be" move H(84) to B(J) add 2 to I add 1 to J when other move A(I) to B(J) add 1 to I J end-evaluate. UPRAVA-WU. evaluate true *> A 1 a 2 Á 3 á 4 B 5 b 6 C 7 c 8 Č 9 č 10 *> x"41" x"61" x"c381" x"c3a1" x"42" x"62" x"43" x"63" x"c48c" x"c48d" when A(I) = H(1) move "A" to B(J) add 1 to I J when A(I) = H(2) move "a" to B(J) add 1 to I J when A(I) = H(3) move x"c3" to B(J) move x"81" to B(J + 1) add 1 to I add 2 to J when A(I) = H(4) move x"c3" to B(J) move x"a1" to B(J + 1) add 1 to I add 2 to J when A(I) = H(5) move "B" to B(J) add 1 to I J when A(I) = H(6) move "b" to B(J) add 1 to I J when A(I) = H(7) move "C" to B(J) add 1 to I J when A(I) = H(8) move "c" to B(J) add 1 to I J when A(I) = H(9) move x"c4" to B(J) move x"8c" to B(J + 1) add 1 to I add 2 to J when A(I) = H(10) move x"c4" to B(J) move x"8d" to B(J + 1) add 1 to I add 2 to J *> D 11 d 12 Ď 13 ď 14 E 15 e 16 É 17 é 18 Ě 19 ě 20 *> x"44" x"64" x"c48e" x"c48f" x"45" x"65" x"c389" x"c3a9" x"c49a" x"c49b" when A(I) = H(11) move "D" to B(J) add 1 to I J when A(I) = H(12) move "d" to B(J) add 1 to I J when A(I) = H(13) move x"c4" to B(J) move x"8e" to B(J + 1) add 1 to I add 2 to J when A(I) = H(14) move x"c3" to B(J) move x"8f" to B(J + 1) add 1 to I add 2 to J when A(I) = H(15) move "E" to B(J) add 1 to I J when A(I) = H(16) move "e" to B(J) add 1 to I J when A(I) = H(17) move x"c3" to B(J) move x"89" to B(J + 1) add 1 to I add 2 to J when A(I) = H(18) move x"c3" to B(J) move x"a9" to B(J + 1) add 1 to I add 2 to J when A(I) = H(19) move x"c4" to B(J) move x"9a" to B(J + 1) add 1 to I add 2 to J when A(I) = H(20) move x"c4" to B(J) move x"9b" to B(J + 1) add 1 to I add 2 to J *> F 21 f 22 G 23 g 24 H 25 h 26 CH 27 Ch 28 cH 29xxxxxxxxx ch 30 *> x"46" x"66" x"47" x"67" x"48" x"68" x"4348" x"4368" x"6348" x"6368" when A(I) = H(21) move "F" to B(J) add 1 to I J when A(I) = H(22) move "f" to B(J) add 1 to I J when A(I) = H(23) move "G" to B(J) add 1 to I J when A(I) = H(24) move "g" to B(J) add 1 to I J when A(I) = H(25) move "H" to B(J) add 1 to I J when A(I) = H(26) move "h" to B(J) add 1 to I J when A(I) = H(27) move x"43" to B(J) move x"48" to B(J + 1) add 1 to I add 2 to J when A(I) = H(28) move x"43" to B(J) move x"68" to B(J + 1) add 1 to I add 2 to J when A(I) = H(29) move x"63" to B(J) move x"48" to B(J + 1) add 1 to I add 2 to J when A(I) = H(30) move x"63" to B(J) move x"68" to B(J + 1) add 1 to I add 2 to J *> I 31 i 32 Í 33 í 34 J 35 j 36 K 37 k 38 L 39 l 40 *> x"49" x"69" x"c38d" x"c3ad" x"4a" x"6a" x"4b" x"6b" x"4c" x"6c" when A(I) = H(31) move "I" to B(J) add 1 to I J when A(I) = H(32) move "i" to B(J) add 1 to I J when A(I) = H(33) move x"c3" to B(J) move x"8d" to B(J + 1) add 1 to I add 2 to J when A(I) = H(34) move x"c3" to B(J) move x"ad" to B(J + 1) add 1 to I add 2 to J when A(I) = H(35) move "J" to B(J) add 1 to I J when A(I) = H(36) move "j" to B(J) add 1 to I J when A(I) = H(37) move "K" to B(J) add 1 to I J when A(I) = H(38) move "k" to B(J) add 1 to I J when A(I) = H(39) move "L" to B(J) add 1 to I J when A(I) = H(40) move "l" to B(J) add 1 to I J *> M 41 m 42 N 43 n 44 O 45 o 46 Ó 47 ó 48 P 49 p 50 *> x"4d" x"6d" x"4e" x"6e" x"4f" x"6f" x"c393" x"c3b3" x"50" x"70" when A(I) = H(41) move "M" to B(J) add 1 to I J when A(I) = H(42) move "m" to B(J) add 1 to I J when A(I) = H(43) move "N" to B(J) add 1 to I J when A(I) = H(44) move "n" to B(J) add 1 to I J when A(I) = H(45) move "O" to B(J) add 1 to I J when A(I) = H(46) move "o" to B(J) add 1 to I J when A(I) = H(47) move x"c3" to B(J) move x"93" to B(J + 1) add 1 to I add 2 to J when A(I) = H(48) move x"c3" to B(J) move x"b3" to B(J + 1) add 1 to I add 2 to J when A(I) = H(49) move "P" to B(J) add 1 to I J when A(I) = H(50) move "p" to B(J) add 1 to I J *> Q 51 q 52 R 53 r 54 Ř 55 ř 56 S 57 s 58 Š 59 š 60 *> x"51" x"71" x"52" x"72" x"c598" x"c599" x"53" x"73" x"c5a0" x"c5a1" when A(I) = H(51) move "Q" to B(J) add 1 to I J when A(I) = H(52) move "q" to B(J) add 1 to I J when A(I) = H(53) move "R" to B(J) add 1 to I J when A(I) = H(54) move "r" to B(J) add 1 to I J when A(I) = H(55) move x"c5" to B(J) move x"98" to B(J + 1) add 1 to I add 2 to J when A(I) = H(56) move x"c5" to B(J) move x"99" to B(J + 1) add 1 to I add 2 to J when A(I) = H(57) move "S" to B(J) add 1 to I J when A(I) = H(58) move "s" to B(J) add 1 to I J when A(I) = H(59) move x"c5" to B(J) move x"a0" to B(J + 1) add 1 to I add 2 to J when A(I) = H(60) move x"c5" to B(J) move x"a1" to B(J + 1) add 1 to I add 2 to J *> T 61 t 62 Ť 63 ť 64 U 65 u 66 Ú 67 ú 68 Ǔ 69 ů 70 *> x"54" x"74" x"c5a4" x"c5a5" x"55" x"75" x"c39a" x"c3ba" x"c793" x"c5af" when A(I) = H(61) move "T" to B(J) add 1 to I J when A(I) = H(62) move "t" to B(J) add 1 to I J when A(I) = H(63) move x"c5" to B(J) move x"a4" to B(J + 1) add 1 to I add 2 to J when A(I) = H(64) move x"c5" to B(J) move x"a5" to B(J + 1) add 1 to I add 2 to J when A(I) = H(65) move "U" to B(J) add 1 to I J when A(I) = H(66) move "u" to B(J) add 1 to I J when A(I) = H(67) move x"c3" to B(J) move x"9a" to B(J + 1) add 1 to I add 2 to J when A(I) = H(68) move x"c3" to B(J) move x"ba" to B(J + 1) add 1 to I add 2 to J when A(I) = H(69) move x"c7" to B(J) move x"93" to B(J + 1) add 1 to I add 2 to J when A(I) = H(70) move x"c5" to B(J) move x"af" to B(J + 1) add 1 to I add 2 to J *> V 71 v 72 W 73 w 74 X 75 x 76 Y 77 y 78 Ý 79 ý 80 *> x"56" x"76" x"57" x"77" x"58" x"78" x"59" x"79" x"c39d" x"c3bd" when A(I) = H(71) move "V" to B(J) add 1 to I J when A(I) = H(72) move "v" to B(J) add 1 to I J when A(I) = H(73) move "W" to B(J) add 1 to I J when A(I) = H(74) move "w" to B(J) add 1 to I J when A(I) = H(75) move "X" to B(J) add 1 to I J when A(I) = H(76) move "x" to B(J) add 1 to I J when A(I) = H(77) move "Y" to B(J) add 1 to I J when A(I) = H(78) move "y" to B(J) add 1 to I J when A(I) = H(79) move x"c3" to B(J) move x"9d" to B(J + 1) add 1 to I add 2 to J when A(I) = H(80) move x"c3" to B(J) move x"bd" to B(J + 1) add 1 to I add 2 to J *> Z 81 z 82 Ž 83 ž 84 *> x"5a" x"7a" x"c5bd" x"c5be" when A(I) = H(81) move "Z" to B(J) add 1 to I J when A(I) = H(82) move "z" to B(J) add 1 to I J when A(I) = H(83) move x"c5" to B(J) move x"bd" to B(J + 1) add 1 to I add 2 to J when A(I) = H(84) move x"c5" to B(J) move x"be" to B(J + 1) add 1 to I add 2 to J when other move A(I) to B(J) add 1 to I J end-evaluate.