Building the COBOL program
Using isCOBOL IDE
1. Click on the File menu
2. Choose New
3. Choose isCOBOL Project
4. Give it the name "simple_COBOL_HTML"
5. Click on the Next button until you reach the page where you can set Compiler/Runtime options
6. It’s good practice to compile with the -whttp option in order to be advised if our program contains statements that are not supported in the Mobile environment. Switch to the “W” page and check the option "-whttp".
7. Click on the Finish button to confirm settings and complete the project creation.
8. Right click on the source folder and choose New
9. Choose Source File
10. Give it the name "hello.cbl" and click on the Finish button
11. Put the
COBOL code into the program and compile it.
Without isCOBOL IDE
1. Create an empty text file and give it the name “hello.cbl”
3. Open a command prompt and change to the directory where the file is
4. It’s good practice to compile with the -whttp option in order to be advised if our program contains statements that are not supported in the Mobile environment.
Compile the program with the command:
5. HELLO.class will be created created; you need to include it in a jar to use it in the future steps. Use the following command:
jar -cvf cobol.jar HELLO.class |
COBOL code
PROGRAM-ID. hello. CONFIGURATION SECTION. REPOSITORY. class web-area as "com.iscobol.rts.HTTPHandler" . WORKING-STORAGE SECTION. 01 hello-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 "hellotext". 05 xml-hellotext pic x any length. LINKAGE SECTION. 01 lnk-area object reference web-area. PROCEDURE DIVISION using lnk-area. main-logic. move "Operation successful" to response-message. move "OK" to response-status. move "Hello World from isCOBOL!" to xml-hellotext. lnk-area:>displayXML (hello-buffer). goback. |