-
Notifications
You must be signed in to change notification settings - Fork 1
/
inspect-replacing.cbl
73 lines (54 loc) · 1.73 KB
/
inspect-replacing.cbl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
identification division.
program-id. inspect-example.
data division.
working-storage section.
77 random-string pic x(6) value "123ABC".
procedure division.
display random-string
*> 123ABC
perform inspect-1.
display "inspect 1 : " random-string
*> ******
move "123123123" to random-string
perform inspect-2.
display "inspect 2 : " random-string
*> 333123
perform inspect-3.
display "inspect 3 : " random-string
*> 334444
perform inspect-4.
display "inspect 4 : " random-string
*> 334344
perform inspect-5.
display "inspect 5 : " random-string
*> 444344
perform inspect-6.
display "inspect 6 : " random-string
*> 222322
goback.
inspect-1.
inspect random-string
replacing characters by "*"
.
inspect-2.
inspect random-string
replacing characters by "3" before initial "3"
.
inspect-3.
inspect random-string
replacing characters by "4" after "33"
.
inspect-4.
inspect random-string
replacing first "4" by "3"
after initial "4"
.
inspect-5.
inspect random-string
replacing leading "3" by "4".
.
inspect-6.
inspect random-string
replacing all "4" by "2"
all "2" by "3"
.