function callServer (cobolProg) { var url = "servlet/isCobol(" + cobolProg + ")"; var parm = $("form").serialize(); $.ajax(url, { success: handleSuccess, error: handleError, data: parm }); return false; } |
callServer("AWEBX"); // program initialization |
INIT. set declaratives-off to true. move low-values to r-awebx-email. open i-o awebxfile. set declaratives-on to true. if file-status > "0z" and file-status not = "41" open output awebxfile close awebxfile open i-o awebxfile. comm-area:>displayJSON (ok-page). goback. |
<input type="submit" value="Insert" onclick="return callServer('AWEBX_INSERT');"> <input type="submit" value="Search" onclick="return callServer('AWEBX_SEARCH');"> <input type="submit" value="Next" onclick="return callServer('AWEBX_NEXT');"> <input type="submit" value="Update" onclick="return callServer('AWEBX_UPDATE');"> <input type="submit" value="Delete" onclick="return callServer('AWEBX_DELETE');"> |
INSERT-VALUES. entry "AWEBX_INSERT" using comm-area. ... goback. SEARCH-VALUES. entry "AWEBX_SEARCH" using comm-area. ... goback. NEXT-VALUES. entry "AWEBX_NEXT" using comm-area. ... goback. UPDATE-VALUES. entry "AWEBX_UPDATE" using comm-area. ... goback. |
<input type="text" name="name" size="25" placeholder="Name"/><br/> <input type="text" name="surname" size="25" placeholder="Surname"/><br/> <input type="text" name="email" size="25" placeholder="E-mail"/><br/> <select name="country" placeholder="Country"> <option value="" selected="selected" disabled="disabled">Country</option> <option value="us">US</option> <option value="it">Italy</option> <option value="fi">Finland</option> <option value="nl">The Netherlands</option> <option value="de">Germany</option> <option value="fr">France</option> <option value="sp">Spain</option> <option value="uk">United Kingdom</option> </select><br/> |
01 comm-buffer identified by "_comm_buffer". 03 filler identified by "_status". 05 response-status pic x(2). 03 filler identified by "_message". 05 response-message pic x any length. 03 filler identified by "name". 05 json-name pic x any length. 03 filler identified by "surname". 05 json-surname pic x any length. 03 filler identified by "email". 05 json-email pic x any length. 03 filler identified by "country". 05 json-country pic x any length. |
INSERT-VALUES. entry "AWEBX_INSERT" using comm-area. comm-area:>accept(comm-buffer). move spaces to error-status. perform check-values. if error-status = spaces move json-name to r-awebx-name move json-surname to r-awebx-surname move json-email to r-awebx-email move json-country to r-awebx-country write rec-awebxfile move "Operation successful" to ok-message;; comm-area:>displayJSON (ok-page) else comm-area:>displayJSON (error-page). goback. |
NEXT-VALUES. entry "AWEBX_NEXT" using comm-area. read awebxfile next move r-awebx-name to json-name move r-awebx-surname to json-surname move r-awebx-email to json-email move r-awebx-country to json-country move "OK" to response-status move "" to response-message;; comm-area:>displayJSON (comm-buffer). goback. |