-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprogram.cbl
56 lines (56 loc) · 2.28 KB
/
program.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
******************************************************************
* Revolt Main
******************************************************************
identification division.
program-id. rv-test-main.
data division.
working-storage section.
copy "rcfg.cpy" replacing ==:pref:== by ==ws==
==:levl:== by ==01==.
procedure division.
initialize ws-config.
move "ws.revolt.chat" to ws-ws-url.
set ws-onrun-pgm to entry "rv-onrun".
call "rv-init" using by reference ws-config end-call.
goback.
end program rv-test-main.
******************************************************************
identification division.
program-id. rv-onrun.
data division.
working-storage section.
copy "rmsg.cpy" replacing ==:pref:== by ==ws==
==:levl:== by ==01==.
01 ws-help-msg pic x(160) value "What?! Please use one of the "
& "following""commands: "
& "&P - Perform a ping! "
& "This bot is a COBOL demostration :-) ".
linkage section.
copy "rcfg.cpy" replacing ==:pref:== by ==ls==
==:levl:== by ==01==.
procedure division using by reference ls-config.
* call static "rv-query-node" using
* by reference ls-config end-call.
initialize ws-msg.
* call static "rv-query-last-msg" using by reference ls-config
* by reference ws-msg end-call.
display "Content-Is: " ws-content(1:25) end-display.
if ws-content is equal to "!pong" then
perform cmd-pong
else
perform cmd-idk
end-if.
goback.
cmd-pong.
initialize ws-msg.
move "Pong from COBOL!" to ws-content in ws-msg.
call static "rv-send-msg" using by reference ls-config
by value "PutChannelIdHere"
by content ws-msg end-call.
cmd-idk.
initialize ws-msg.
move ws-help-msg to ws-content in ws-msg.
call static "rv-send-msg" using by reference ls-config
by value "PutChannelIdHere"
by content ws-msg end-call.
end program rv-onrun.