Is there a cobfile for Visual Cobol?

In Server Express you have the command cobfile that you can use to identify how a gnt file was built, i.e.

$ cobfile k9initora.gnt
k9initora.gnt: Micro Focus 64-bit generated code file for Intel x86 (Win64)

$ cobfile k9initora.gnt
k9initora.gnt: Micro Focus 64-bit generated code file for HP/UX IA64

My question is simple, with Visual Cobol is there some tool that can do this? 

/Robert

  • Hi.

    The same "cobfile" tool is found in Visual COBOL.

        $COBDIR/bin/cobfile

  • Hm, that's weird I don't seem to have it. As far as I know it's a standard install of VC.

    C:\Program Files (x86)\Micro Focus\Visual COBOL\bin>echo %COBDIR%
    C:\Program Files (x86)\Micro Focus\Visual COBOL\;

    C:\Program Files (x86)\Micro Focus\Visual COBOL\bin>dir cobfile*
    Volume in drive C is Lokal disk
    Volume Serial Number is B02F-BBE0

    Directory of C:\Program Files (x86)\Micro Focus\Visual COBOL\bin

    File Not Found

    On another note. Don't know why there's a ";" in my COBDIR but it's not something I've fiddled with.

  • Verified Answer

    cobfile is available only in the Linux/Unix versions of Visual COBOL which would be the DevHub product.

    The version you have installed is the Windows version and that does not provide that tool.

  • Some background:

    The "cobfile" tools is a wrapper around the standard Linux/Unix "file" utility.

    The standard "file" utility can consume a custom "magic" file which is used to identify the file and we provide a custom magic file in $COBDIR/etc/cobmagic with product specific identifiers.

    So,  in order to provide the same feature on Microsoft or Micro Focus would also need to provide a "file" command that can process this customer magic file.

  • OK then, WSL on Win 10 to the rescue. Move the cobmagic file to your devbox, write a script named cobfile that does the following (haven't bothered about that warning message yet):

    $ cd /mnt/c/temp
    $ file -m /mnt/c/usr/local/etc/cobmagic d9initora.gnt
    /mnt/c/usr/local/etc/cobmagic, 35: Warning: description `not succ Micro Focus 32-bit intermediate code file (incomplete/' truncated
    d9initora.gnt: Micro Focus 64-bit generated code file
    $ file -m /mnt/c/usr/local/etc/cobmagic d9dberror.gnt
    /mnt/c/usr/local/etc/cobmagic, 35: Warning: description `not succ Micro Focus 32-bit intermediate code file (incomplete/' truncated
    d9dberror.gnt: Micro Focus Server Express 32-bit generated code file

     

    /robert

     

    #! /bin/bash

    # cobfile

    #

    test $# -gt 0 || exit 1

    file -m /mnt/c/usr/local/etc/cobmagic $*

    exit