Menu

COBOL Trace File Not Getting Created in CHUI on Linux (GNU COBOL 2.2, RHEL 7.0)

2025-06-12
2025-06-12
  • Anshul Agrawal

    Anshul Agrawal - 2025-06-12

    Hi,

    I'm currently working on a character-based (CHUI) COBOL screen application on a Linux platform (GNU COBOL 2.2, Red Hat Enterprise Linux 7.0). I’m trying to generate a trace file for debugging purposes, but it’s not getting created.

    I’ve already added the following to my. profile:

    export COB_SET_TRACE=Y
    export COB_TRACE_FILE="$HOME/cob_trace.out"
    

    However, the trace file is still not being generated when I am using CHUI screens. I am able to see Cobol display values in screen itself.

    Does anyone know if there are any additional configurations or environment variables required to enable trace file generation for GNU COBOL in a CHUI environment? Any guidance would be greatly appreciated.

    Thanks in advance!

     
    • Simon Sobisch

      Simon Sobisch - 2025-06-12

      A trace file is only generated if you've compiled with -ftrace / -ftraceall.

      If you can't recompile but have compiled the COBOL runtime with debug symbols (CFLAGS=-g or --enable-debug) you can use GDB for some tracing, but that would most likely be only program entry+exit (if I remember, that depends on if you compiled with -fsource-location / --debug).

      Note: GnuCOBOL 2.2 is very outdated (and both -fsource-location and -ftraceall have a recognizable performance penalty in that old version - but not in 3.2 any more) - you really want to update to a slightly patched 3.2 (EPEL has RPMs if you don't want to compile from source).

       

      Last edit: Simon Sobisch 2025-06-12
  • Anshul Agrawal

    Anshul Agrawal - 2025-06-12

    Thank Simon for the response.

    I have started working on RH8 with GNU 3.2 but I haven't setup for GDB yet.I need to check how to configure GDB properly with my account.

    Any specific steps required please let me know.

     
    • Simon Sobisch

      Simon Sobisch - 2025-06-12

      With GC32 and compiling with -ftrace (for entry-points, section and paragraphs) or -fraceall (for each code line) you won't see a big performance penalty.
      You can then use COB_SET_TRACE to enable tracing globally - or use READY TRACE in a COBOL module to enable it and RESET TRACE to disable it so you get the tracing of all modules where you enabled it.

      In this case: no GDB required for that. I still suggest to compile each COBOL module with -g - nearly zero performance penalty but if you ever want to monitor deeper using common performance tools, you have a good preparation (in production: I always run -g compiled modules).

      (If you have questions on GnuCOBOL and gdb, please use the search function first, then post to an existing topic or create a new one if your questions do not match any existing topic).

       

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.