skip to main content

Converting Java Source Code to Object-oriented COBOL : Java Program Converted to isCOBOL

Java Program Converted to isCOBOL
Here is the example Java program used in this document after being translated to Object Oriented COBOL:
       PROGRAM-ID. webcontent.
       CONFIGURATION SECTION.
       REPOSITORY.
           class jBufferedReader    as "java.io.BufferedReader"
           class jInputStreamReader as "java.io.InputStreamReader"
           class jURL               as "java.net.URL"
           class jURLConnection     as "java.net.URLConnection"
           class jString            as "java.lang.String"
           class jSystem            as "java.lang.System"
       WORKING-STORAGE SECTION.
       77  url       object reference jURL.
       77  uc        object reference jURLConnection.
       77  bf        object reference jBufferedReader.
       77  inputLine object reference jString.
       PROCEDURE DIVISION.
             set url to jURL:>new ("http://www.veryant.com"
             set uc  to url:>openConnection() 
             set bf  to jBufferedReader:>new
             perform until exit
                set inputLine to bf:>readLine()
                if  inputLine = null
                jSystem:>out:>println (inputLine)
           catch exception

Copyright (c) 2017 Veryant
Contact us
Please share your comments on this manual or on any
Veryant product documentation with the email button at the top left