Menu

COBOL on Android

2026-03-08
2026-03-10
  • Paul Newton

    Paul Newton - 2026-03-08

    im using cobol ide&c on android.
    the accept instructio does not work.
    ie the code does not stop and await input.
    any ideas?

     
    • Simon Sobisch

      Simon Sobisch - 2026-03-09

      It works for me... I'm using Termux and installed GnuCOBOL there - works like a charm; I edit the file using different editors like acode.

      ... I don't have any clue what your ide&c is.
      Maybe it is one of the many "cloud compilers" environment where you don't have any stdin?

       
  • Paul Newton

    Paul Newton - 2026-03-10

    cobol IDE was a simple download of an app to my android phone. It worked immediately . GNU Cobol seems very complex to install.

     
    • Simon Sobisch

      Simon Sobisch - 2026-03-10

      Then whatever issue you have is most likely the result of using one of the existing web-frontends - easy check: disable WIFI, then try to compile + run COBOL.

      For easy local GnuCOBOL on Android:

      • install Termux app
      • open it and issue pkg update && pkg install gnucobol
      • use it (cobc -xj yourprogram.cob will compile and run it)

      Seems easy to me... (the "hardest part" is to configure your editor - if you don't use nano or something else within termux) to save the files in a folder that termux can access (possibly needs a bit of setup but should be well documented), then switching to termux when you want to compile/run [there should be options to execute termux scripts from other applications, but I haven't looked into it).

       
      👍
      1
  • Michael Del Solio

    With the hints from Simon I tested it on my Android Phone and I am really surprised that it works well without a big effort. Great :-)

    These are my steps:
    Installing Termux App from Playstore.
    Open the App - we are just in a shell.

    Updating the system:

    pkg update
    pkg upgrade
    

    Installing GnuCOBOL:
    pkg add gnucobol
    (it comes with json, xml and vbisam)

    clang is important, too. But it doesn't come automatically, so I installed it with:
    pkg add clang

    Now, cobc --versionworks. Version is 3.2.

    Then create a simple COBOL program with the nano editor:
    nano hello.cob

    I'm familiar with nano from using it on other Linux boxes so it is ok for now for creating a simple program without any good style, just for testing:

    identification division.
    program-id. hello.
    
    data division.
    working-storage section.
    77 ws-name pic x(20).
    
    procedure division.
    display "Hello"
    display "Your name: "
    accept ws-name
    display "Your name is: " ws-name
    stop run.
    

    Then I compile and run it with:
    cobc -xj --free hello.cob

    The program runs and stops, waiting for accepting ws-name from the shell.
    Then ws-name is displayed as expected.

    In Termux shell command line history works, too.

    Maybe nano can be configured with syntax highlighting for COBOL?!

    EDIT:
    I found a nano resource file for COBOL syntax highlighting and installed it on Termux shell with:

    mkdir -p ~/.nano
    cd ~/.nano
    curl -O https://raw.githubusercontent.com/Martinfx/nanorc/refs/heads/master/gnucobol.nanorc
    
    echo 'include "~/.nano/gnucobol.nanorc"' >> ~/.nanorc
    

    It works but only if all keywords are in UPPER case ... :-)

     

    Last edit: Michael Del Solio 2026-03-10
  • Mickey White

    Mickey White - 2026-03-10

    Thanks this is cool. Appears to work...
    Years ago I put UserLAnd on my android phone, and it lets you select different linux distros. I have gucbolol 2.2 on it. I can not remember at all how to get to the file system directly from the phones files system. didn't bother me enough to look into though....
    Termux looks lots easier and better....

     
    👍
    1

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB