identification division. program-id. server. * simple NetIPC example; listen, accept, reveive, send, shutdown data division. working-storage section. 01 port-opt. 03 opt-len pic s9(4) comp value 14. 03 opt-num pic s9(4) comp value 1. 03 opt-ent. 05 opt-code pic s9(4) comp value 128. 05 opt-offs pic s9(4) comp value 12. 05 opt-dlen pic s9(4) comp value 2. 05 opt-resv pic s9(4) comp. 03 opt-dat. *05 opt-port pic s9(4) comp value 32080. 05 opt-port pic xx value "}P". 01 call-desc pic s9(9) comp. 01 result pic s9(9) comp. 01 vc-desc pic s9(9) comp. 01 client-data pic x(06) value "??????". 01 server-data pic x(06) value "Server". 01 client-want pic s9(9) comp value 6. 01 client-have pic s9(9) comp value 0. 01 client-temp pic s9(9) comp. 01 client-offs pic s9(9) comp. 01 graceful pic s9(9) comp value 16384. procedure division. main-body. display "calling ipccreate..." call intrinsic "ipccreate" using 3, 4, \\, port-opt, call-desc, result display "result = " result if result <> 0 then stop run end-if display "calling ipcrecvcn..." call intrinsic "ipcrecvcn" using call-desc, vc-desc, \\, \\, result display "result = " result if result <> 0 then stop run end-if display "calling ipcshutdown for lstn..." call intrinsic "ipcshutdown" using call-desc, \\, \\, result display "result = " result if result <> 0 then stop run end-if display "calling ipcrecv for data..." perform with test before until client-want = 0 display "want = " client-want display "have = " client-have compute client-temp = client-want compute client-offs = client-have + 1 call intrinsic "ipcrecv" using vc-desc, client-data(client-offs:client-temp), client-temp, \\, \\, result display "result = " result if result <> 0 then stop run end-if compute client-have = client-have + client-temp compute client-want = client-want - client-temp end-perform display "client request is " client-data display "server response is " server-data display "calling ipcsend for data..." call intrinsic "ipcsend" using vc-desc, server-data, 6, \\, \\, result display "result = " result if result <> 0 then stop run end-if display "calling ipcshutdown for conn..." call intrinsic "ipcshutdown" using vc-desc, graceful, \\, result display "result = " result stop run. end program server.