Tapatalk

Micro Focus compiler

Micro Focus compiler

16
Basic UserBasic User
16

    Dec 17, 2020#1

    I am trying to set up UES to compile programs with a fairly old - but still functional - compiler. So far without success.
    I have set up a project - coboltest - but its not clear to me what I should put in the Compiler options.
    To compile a COBOL program with Micro Focus I need the following:
    - compile:  <path to compile option>\cobol coboltest omf(obj)
    - link         :  <path to link option>\cbllink coboltest.obj
    I've put in the  Default Run config: Command Line Arguments=coboltest.exe but I'm not sure what to do next. If I Compile the program I get zero errors  and coboltest.obj shows in the output window. If I Build I get coboltest.exe with zero errors. If I try to run the application I get a message box saying:

    "One or more files are out of date or don't exist. These files need to be rebuilt: COBOLT~.obj. Would you like to build them?" Saying YES produces a Windows command window with "COBOLTEST.EXE is not recognised as an internal or external command, operable program or batch file. Press any key to continue ..."

    Despite getting zero errors in the compile/build of the program there is no copy of the .exe file anywhere on my hard disk.

    I'd appreciate some assistance 😉

    6,685587
    Grand MasterGrand Master
    6,685587

      Dec 17, 2020#2

      I don't know anything about Micro Focus compiler, but I know how to setup an UEStudio compiler configuration as having that done already several times for several different compilers. So I am sure I can help you with a bit more information about Micro Focus compiler.

      I need to know first which user interface do you use: ribbon mode or toolbar/menu mode with contemporary menus or toolbar/menu mode with traditional menus?

      I assume ribbon mode for everything written below.

      Second, which version of UEStudio do you use and in which directory is UEStudio installed?

      I assume 64-bit UEStudio version 20.10.0.58 (currently latest) installed into %ProgramFiles%\IDM Computer Solutions\UEStudio.

      There is no directory with name Micro Focus Compiler in %ProgramFiles%\IDM Computer Solutions\UEStudio\configs (or wherever UEStudio is installed).

      So I would need to know which compiler you have configured for the project. Click on ribbon tab Build on small down arrow of first item Set Compiler Options respectively this text in first group Settings and click on first popup menu item Select compiler. It is also possible to click on ribbon tab Project in first group Project on item Project settings, select second tab Settings and click on button Set/change compiler which opens the same window.

      We can create together a complete new compiler configuration for Micro Focus compiler if none of the existing compiler configurations is really useful for Micro Focus compiler. In this case I suggest to open Windows File Explorer as administrator, browse to folder COBOL Compiler in %ProgramFiles%\IDM Computer Solutions\UEStudio\configs, copy the folder COBOL Compiler with Ctrl+C, paste it into the same directory with Ctrl+V and rename the pasted folder to Micro Focus Compiler. Then (re)start UEStudio and select Micro Focus Compiler for the project.

      Note: COBOL Compiler contains two configurations: Application to compile a project to an application and Dynamic Library to compile a project to a DLL. I assume Application is what you need first.

      Many older compilers do not register themselves in Windows registry and so UEStudio cannot find out the compiler path by querying the registry. For that reason there must be opened for such an old compiler on ribbon tab Build in first group Settings with a click on text of first item Set Compiler Options the popup menu and click on last item Set compiler paths. In the opened window the user can configure the paths of the older compiler(s) to use.

      If a folder Micro Focus Compiler was created by you before in configs subfolder of UEStudio program files folder, this compiler is not shown in this dialog window as this newly created compiler configuration is not yet known by UEStudio. But that does not matter as the data entered in this dialog window is stored in the file %APPDATA%\IDMComp\UEStudio\cset.paths which is a text file. It can be opened in UEStudio and we can add a line like microfocus=C:\MicroFocus to define a variable microfocus with path of this compiler containing the executables to compile and link with Micro Focus compiler.

      In case of having created a folder Micro Focus Compiler in configs, it is necessary to once again click on ribbon tab Project in first group Project on item Project settings, select tab Settings, click on button Set/change compiler, click on button Edit configuration and click on Make configuration local (save in project directory). This is required as the Application configuration in UEStudio´s configs folder is write-protected by Windows default and we have to make some changes on the compiler configuration for Micro Focus compiler. This can be done easier on a copy of it in the projects directory which is not write-protected. Later the final project specific configuration can be used to replace the configuration in UEStudio´s configs folder to have it ready for similar projects in future.

      The Select Compiler window shows on right side at top the variables which are offered by UEStudio itself in a comment block. There are several sections. These sections are described in help of UEStudio. So please open the help of UEStudio, select second tab Index and you can see at top of the index list the items [.EXT] Compiler Section, [Build] Compiler Section, etc. The help page opened on double clicking on one of these items describes the section and the variables. We can work together to define those sections correct for Micro Focus compiler so that the configuration can be used for your current project, other projects in future, and of course finally also for other users of UEStudio which want to use UEStudio for COBOL projects compiled with Micro Focus compiler. The compiler configuration file looks difficult to understand and customize, but it isn't on knowing well the used compiler and its options. The compiler configuration is just a set of instructions which compiler options to offer the user in dialog opened on clicking in Project Settings window on tab Settings on button Compiler options so that the user can define options for each project without the need to modify every time the configuration file and how to create the make file by UEStudio on just compiling active source code file to an object file, or build or rebuild an entire project without or with debugging options depending on which Build mode is currently selected by the user for the project.

      It would be easier for me and less time consuming for you if you can compress into a 7-Zip, RAR or ZIP file the entire compiler folder and in another archive file also your project folder with your current source code file(s) or in case of source code cannot be shared public, a project with just one source code file with a simple "hello world" source code and you attach the two archive files to your next post using Full Editor & Preview where it is possible to attach files. Then I can "install" the compiler also on my machine, open your project and setup the configuration file for the Micro Focus compiler and test a compile, build and rebuild with your project.

      PS: It is also possible to configure two project tools, one for compilation of active file and one for linking the object file of active file to an executable or the dynamic library (or one project tool to do both using a batch file). That must be done by UltraEdit users as UltraEdit does not support various compilers based on a compiler configuration. But I recommend for UEStudio to take the time creating a compiler configuration on no installed compiler configuration being useful as working with a compiler configuration for current project and future projects has many advantages in comparison to working just with one or more project tools.
      Best regards from an UC/UE/UES for Windows user from Austria

      16
      Basic UserBasic User
      16

        Dec 17, 2020#3

        Hi Mofi

        Toolbar/menu mode with contemporary menus
        UEStudio Version 20.0.050 - 32-bit installed in Program Files (86)\IDM Computer Solutions\UEStudio
        Confirm: there is no Micro Focus compiler in configs

        I chose the default COBOL Compiler option since this was the only COBOL compiler available.I did not create a Micro Focus compiler in the configs section but I inserted Micro Focus compiler paths/commands in the Compiler dialog:

        Target=COBOLtest.exe
        Working Directory=c:\workarea\cobol32\coboltest
        Command Line Arguments=COBOLtest.exe  <<<<----- probably incorrect??
        Compiler Options=c:\cobol32\exedll\cobol.exe    <<<<< --- this is the MF compiler
        Link With=c:\cobol32\exedll\cbllink.exe   <<<< ---- this is the MF linker
        Linker Options=coboltest.obj   <<<<< ---- the .obj file created by MF compiler
        I didn't complete any  of the other entries.  cset.paths has this correct entry: cobol=C:\COBOL32\exedll

        I appreciate your offer to try and set up the configuration for me but a zipped archive of the MF compiler would be at least 50 MBs. I don't think my email provider would accept such a big file.

        Paul

        6,685587
        Grand MasterGrand Master
        6,685587

          Dec 18, 2020#4

          Please don't be afraid of the long post. I think, it does not take more than 30 minutes to read the very detailed instructions and setup the configuration correct for Micro Focus compiler.

          Okay, thanks for the details on your UEStudio, Micro Focus compiler and your project.

          I setup the same environment as you by doing following:
          1. I created a directory C:\workarea\cobol32\coboltest.
          2. I copied C:\Program Files (x86)\IDM Computer Solutions\UEStudio\changes_ues.txt to directory C:\workarea\cobol32\coboltest and renamed this file to source.cbl. That is of course no valid COBOL source code file, but that does not matter.
          3. I created a directory C:\cobol32\exedll.
          4. I copied a small executable with file name cobol.exe into the directory C:\cobol32\exedll. Next I copied the same executable once again into same directory with file name cbllink.exe. The executable was written by myself in C and compiled with Visual C 6.0 to a Windows console application. It just outputs to standard output all argument strings passed to the executable.
          5. I started 32-bit UEStudio v20.10.0.58 and set as user interface mode toolbar/menu mode with contemporary menus.
          6. I clicked in menu Build in submenu Set Compiler Options on item Set compiler paths, clicked on button ... right to COBOL Compiler, browsed to the folder C:\cobol32\exedll, clicked on button OK and closed the Compiler Paths window with button Close.
          7. I clicked in menu Project in submenu New project on item New project.
            (New project using templates would be also possible because there is in C:\Program Files (x86)\IDM Computer Solutions\UEStudio\projects\COBOL Compiler a file with name User Defined Template.wiz, but that does not seem to be useful on using a different COBOL compiler.
          8. I browsed to directory C:\workarea\cobol32\coboltest, entered as file name coboltest and clicked on button Save.
          9. I clicked on button Add file... and added the file source.cbl and opened this file with a double click on it in the tree.
          10. I selected second tab Settings, clicked on button Set/change compiler, clicked on button COBOL Compiler and selected Application as the compiler configuration to use.
          The next steps must be done also by you to get the Application configuration of COBOL Compiler working for Micro Focus compiler.
          1. In the Select Compiler window click on button Edit configuration and next on button Make configuration local (save in project directory).
          2. Scroll down on right side to section [Variables]. There should be as first variable defined CPATH (short for compiler path) with the path C:\cobol32\exedll. If the default path C:\COBOL is displayed because of having used Set compiler paths after having created the local configuration, just click on button Make configuration local (save in project directory) and UEStudio deletes the local configuration and then press once again on button Make configuration local (save in project directory) to create the local compiler configuration new. This action results in creating a subdirectory Configs in the project directory C:\workarea\cobol32\coboltest with the subdirectory COBOL Compiler and the file Application which is a copy of C:\Program Files (x86)\IDM Computer Solutions\UEStudio\configs\COBOL Compiler\Application.
          3. Next look on next section [Environment] which defines first the environment variable PATH for the compile/build/rebuild process. The part ;$(CPATH)\BIN can be most likely deleted as there is no directory C:\cobol32\exedll\BIN.
          4. In section [Environment] are also defined the environment variables INCLUDE and LIB. These two environment variables are very common for compilers.

            The environment variable INCLUDE holds the path to the directory containing the header files installed with the compiler. For a C/C++ compiler this directory contains usually the *.h files like stdio.h or string.h included in C/C++ source code files with the instruction #include <stdio.h>. I don't know if COBOL is a programming language supporting also standard header files to include. If the answer is yes, make sure the environment variable INCLUDE is correct defined here. A path starting with $(CPATH) and relative path components is also possible, like $(CPATH)\..\include.

            The environment variable LIB holds the path to the directory containing the library files installed with the compiler. For a C/C++ compiler this directory contains usually the *.dll and *.lib files. I don't know if COBOL is a programming language supporting also standard library files to use during linking the object file(s) to an executable or dynamic library. If the answer is yes, make sure the environment variable LIB is correct defined here. A path starting with $(CPATH) and relative path components is also possible, like $(CPATH)\..\lib.

            Note: If there is among C:\cobol32\exedll also C:\cobol32\include and C:\cobol32\lib, it would be better to select in Compiler Paths window the path C:\cobol32 and define in local configuration of the compiler in section [Environment] the environment variable PATH with $(CPATH)\exedll;%PATH% to be able to use for the environment variable INCLUDE the value $(CPATH)\include and for the environment variable LIB the value $(CPATH)\lib.
          5. Click on button Save configuration on having something edited in the configuration and next on button OK to close the Select Compiler window.
          6. In my case I was back in the Project Settings window on second tab Settings where I selected for Build mode the option Release.
          7. I closed the Project Settings dialog window with a click on X symbol.
          I wanted to test now if clicking in menu Build on item Compile results in running C:\workarea\cobol32\coboltest\cobol.exe for active file C:\workarea\cobol32\coboltest\source.cbl. Yes, this worked. My program output the following text which was captured by UEStudio and written to the output window:

          Code: Select all

          Argument 0: COBOL
          Argument 1: ..\..\COBOLT~1\source.cbl,source.obj,
          I suggest to click in menu Layout in submenu Toolbars on item Build to get the Build toolbar displayed. Click on last item Commands of this toolbar and click in popup menu on last item Show makefile. That results in opening the file C:\workarea\cobol32\coboltest\Release\coboltest.mak which is the make file created by UEStudio for the compilation of file source.cbl.

          UEStudio sets the selected Build mode directory always as current directory on running make with the make file in this directory. The project files are referenced by default with using a path relative to project directory if that is possible. This behavior can be changed in the compiler configuration file to use always full qualified path instead of a relative path. In this case is also defined in the compiler configuration to use the short 8.3 file names as it looks like the COBOL compiler for which this configuration was written by a UEStudio user in the past is a 16-bit application not supporting long file names.

          Next I clicked in Build toolbar on fourth item Build. It is also possible to click in menu Build on menu item Build.

          There is again output by my cobol.exe the two lines, but next was captured by UEStudio the error message:

          Code: Select all

          'COB' is not recognized as an internal or external command,
          operable program or batch file.
          In other words the linking process step failed because of not finding the executable doing the linking.

          So I clicked on toolbar Build on first item Project settings, selected tab Settings and clicked once again on Set/change compiler. The window Select Compiler is opened again displaying on right side the local configuration. I explain a bit more now the other sections.

          The section [General] defines some general settings evaluated by UEStudio. The variable TargetExt is responsible for the definition of the file extension appended to project name to define the target file created on doing a Build or Rebuild. For applications is defined usually .EXE or .exe and for dynamic libraries .DLL or .dll. ReleaseOut and DebugOut define the directory names for the output directory created by UEStudio in the project directory on having selected as Build mode either Release or Debug. I think the variables UseFullPaths and UseDosNames are self-explaining and are the reason why the COBOL compiler configuration results in creating the make file by UEStudio with using file paths relative to release/debug output directory using short 8.3 names.

          We have used already the last line makef in section [MakeCommands] by clicking in toolbar Build on the last item Commands. In this section are defined special commands to show in the popup menu. The value assigned to a command is the name of a section below like [Show Makefile]. The command section [Show Makefile] defines the Title as shown in popup menu, which command(s) to execute and some additional options used to define the execution environment. Please refer to help of UEStudio if you are interested in the options which can be defined for such a section and what are their meanings.

          Important for us is the last section [.CBL] which defines what should be done on compilation of a project file with the file extension .cbl. It defines first that the output file created during compilation should have the name of the source file with file extension .obj instead of .cbl. There would be two variables to define one or more flags (options) for the used compiler for the Build mode Debug and Release. There is nothing defined for the COBOL compiler. Cmd0 defines the (first) command line to execute on compilation of a .cbl source file. In our case cobol.exe is executed with the project file as first argument separated by a comma from output file name as defined by above. $R is briefly explained at top of the compiler configuration with release/debug setting for linker which is not really a good description. In real $R references the string assigned to DebugFlag or ReleaseFlag according to Build mode currently set for the project. There are usually some options different for compilation with debugging options (no or just a little optimization, include symbols for debugging) and for release compilation (full optimization, no symbols for debugging).

          In the file coboltest.mak still opened in UEStudio it can be seen in section COMPILE how the definitions of compiler section [.CBL] produce for source.cbl the make instructions to produce source.obj by running the command line:

          Code: Select all

          COBOL ..\..\COBOLT~1\source.cbl,source.obj,
          However, the main problem is the linking. For the linking the compiler section [Build] must be correct defined in the compiler configuration. We can see here that the output of the linking process should be the target file as defined by default with project name with TargetExt value appended as file extension. The linking process depends on the file group FGO (short for file group output, could be any name) as defined in section [FileGroups]. In other words mymake.exe in program files folder of UEStudio executed by UEStudio after creation of the make file in the output directory according to currently selected Build mode must first make sure that for each *.cbl file of the project the *.obj file is created using the COBOL compiler command line as defined by section [.CBL]. mymake.exe runs the compiler cobol.exe for a *.cbl file only if the source file is newer than the *.obj file. The command Rebuild results in first running CLEAN as defined in the make file to delete the target file and all the object files and than do a Build with a Compile for each *.cbl file before running the linker as defined with Cmd0 in section [Build].

          COB is definitely wrong for Micro Focus compiler as the executable has the file name cbllink.exe. So COB must be modified to cbllink or cbllink.exe. (The definition of the executable with file extension is a very little bit faster.) Click on the buttons Save configuration and OK and on X symbol of window Project Settings after this modification.

          Next click in menu Build on Regenerate makefile if UEStudio has not automatically created the make file new after making this modification in compiler configuration. It can be seen now in the make file in section BUILD that the target file for linking coboltest.EXE is created with execution of:

          Code: Select all

          cbllink.exe -X:LRS -Ocoboltest.EXE $(FG00)
          $(FG00) (file group outputs 0) is the list of *.obj files according to *.cbl files of the project.

          In my case I get output into the output window on running a Build with my program being cbllink.exe:

          Code: Select all

          Argument 0: cbllink.exe
          Argument 1: -X:LRS
          Argument 2: -Ocoboltest.EXE
          Argument 3: source.obj
          So I was finished with the configuration. But I suppose the linking options are not really right for you as cbllink.exe requires most likely different options than not existing COB.exe. So we have to do more.

          Now it is essential to know which options the compiler executable cobol.exe and the linker executable cbllink.exe offer and which one to use for the current project. In the compiler configuration are the sections
          • [Settings] ... defines the possible values for the compiler/linker options.
          • [SettingsInfo] ... defines the information shown the user for each compiler/linker option defined in [Settings].
          • [SettingsReps] ... defines the compiler/linker options used on running the compiler/linker executable depending on the values selected or entered for each setting.
          The string values assigned to the variables as defined in section [SettingsReps] are used in the section [Variables] to form the a string with several options assigned to variable COPT for compilation and LOPT for linking (last step in build process).

          The variables defined in section [Variables] can be used now in section [.CBL] on the lines which define DebugFlag and/or ReleaseFlag or directly on Cmd0 command line to execute for compilation of a *.cbl file as well as in section [Build] on Cmd0.

          So let us open now the Project settings and click on second tab Settings on button Compiler options showing a dialog window to configure the compiler and linker options as defined in the section [Settings], evaluated according to [SettingsReps] forming the string for the variables defined in [Variables] and used on running Cmd0 as defined in section [.CBL] for compilation of each *.cbl project file and Cmd0 as defined in section [Build] to link all the object files together to target executable file.

          The first option is Target to redefine the target file name referenced with $T in the compiler configuration which is defined by default with project name and value of variable TargetExt appended. This first option gives the user the possibility to define a different executable file name independent on the defaults. It is up to you what you want to enter here.

          The two options below DEFAULT RUN CONFIGURATION are only of interest if you ever click in toolbar Build on last item Commands and click next on first item Execute coboltest.EXE. Then UEStudio runs mymake.exe with option run to run the executable as defined in the make file in section COMMANDS created according to compiler configuration in section [Execute Application].

          The section COMPILER OPTIONS contains only the setting Compiler Options. So the creator of the COBOL configuration file has defined in section [Settings] no option for compilation of a *.cbl file at all. The user has to enter here the options to use on running the compiler executable. So you have to study the manual of cobol.exe to define the string which is appended at end of the command line running cobol.exe.

          The section LINKER OPTIONS contains Linker Options where a user can enter all the options to use on linking which is in your case the executable cbllink.exe. So I recommend to enter here the linker options needed to link the object files. But the creator of COBOL compiler configuration decided to offer some of the linker options to be configured more easily directly and processing them according to the sections [SettingsReps] and [Variables] for usage on Cmd0 in section [Build]. I cannot tell you if these settings can be used at all or if you better rewrite these sections to get finally the needed linker command line.

          You can of course modify Cmd0 in section [Build] from

          Code: Select all

          cbllink.exe $(LOPT) -O$O $FGO $FGL
          to

          Code: Select all

          cbllink.exe WHATEVER LINKER OPTIONS NEEDED -O$O $FGO $FGL
          Then ALL the options in the section LINKER OPTIONS in the Compiler Options are ignored on linking as none of them are referenced in the command line written into the make file for linking the object files of the project source files to an executable file.

          I hope this helps you to get the COBOL compiler configuration correct adapted for Micro Focus compiler for at least building or COBOL project to an executable running fine. Let me know if you want to know more.

          PS: Click in menu Build on Options and check Show build commands when executing. Then you can see in output window also the command lines used by mymake.exe to compile the *.cbl file(s) with cobol.exe and link the object file(s) with cbllink.exe to the executable file as defined in the compiler options window.
          Best regards from an UC/UE/UES for Windows user from Austria

          16
          Basic UserBasic User
          16

            Dec 19, 2020#5

            Mofi

            Thank you for your very full explanation. Would it help if I showed you my MF setup?

            Set Environment variables:

            I first set up Environment variables:

            set path=c:\cobol32\exedll;          
            set cobdir=c:\cobol32\lbr; c:\cobol32\exedll;
            set lib=c:\cobol32\lib;

            Compiler (cobol.exe) and Linker (cbllink.exe) reside in folder c:\cobol32\exedll

            Compile source file:

            To compile I issue command:

            (c:\cobol32\exedll\) cobol.exe source.cbl

            Link:

            Then to link:

            (c:\cobol32\exedll\) cbllink.exe source.obj

            Source file directory:

            The source file is in this directory:

            c:\workarea\cobol32\coboltest  Example:  c:\workarea\cobol32\coboltest\source.cbl

            Does this make it clearer what I am trying to do and how to set up UEStudio ? I appreciate your efforts.

            Paul

            6,685587
            Grand MasterGrand Master
            6,685587

              Dec 19, 2020#6

              I have understood fully the environment already after your second post. I have explained what you need to do to change the compiler configuration for Application from COBOL Compiler to be suitable for Micro Focus compiler without knowing the options which can/must be used for compilation of a *.cbl file using cobol.exe and the options which can/must be used for linking the *.obj files with cbllink.exe. I do not understand what you want to tell me with your third post. There is no set path=c:\cobol32\exedll; or anything else written by you to write into the project local configuration file to be able to compile the active *.cbl file or build/rebuild the entire project with one or more *.cbl files.
              Best regards from an UC/UE/UES for Windows user from Austria

              16
              Basic UserBasic User
              16

                Dec 19, 2020#7

                Mofi

                I wasn''t sure that I had explained the MF compile/link process clearly. Anyway, I am  on holiday for a few days and when I get back I will go through your explanation and attempt to correctly set up UEStudio for the MF compiler.

                Paul

                  Dec 21, 2020#8

                  Mofi

                  I have read through your explanations very carefully and I still cannot get a successful compilation. I have attached a screenshot of my last attempt and also the .mak file. So either I have misunderstood your explanations or it appears to be not possible to configure UEStudio for the MF compiler.

                  Thank you for your assistance,
                  COBOLtest.mak (1.32 KiB)   0
                  UEStudio.docx (374.56 KiB)   0

                  6,685587
                  Grand MasterGrand Master
                  6,685587

                    Dec 21, 2020#9

                    It looks like you have correct adapted the compiler configuration file to run cobol.exe and cbllink.exe, but the argument strings respectively options passed to these two executables are not correct. I cannot really help you regarding to the options required for the compiler and for the linker. The command line options are documented most likely in the documentation of the Micro Focus compiler which I do not have. If there is somewhere a web page explaining the options, please let me know and I can read them too. Otherwise you have to read the documentation by yourself and modify the compiler configuration accordingly.

                    I recommend first to change in section [General] the value of UseDosNames from 1 to 0 as it looks like the Micro Focus compiler executables are 32-bit Windows console applications supporting long file names.

                    cobol.exe is executed without any error message, but it looks like also without generating the file COBOLT~1.obj. So the arguments passed to this executable are obviously not right.

                    You must modify in section [.CBL] the line Cmd0 which is currently COBOL $I,$O,$R $(COPT). I have no documentation for cobol.exe to tell you what you must write here. I cannot run in a command prompt window C:\cobol32\exedll\cobol.exe without any argument or with argument --help or -h or /? or -? to get output the usage information for this executable.

                    I can only tell you that $R references the string assigned to DebugFlag or ReleaseFlag in section [.CBL] which is always an empty string and therefore the comma and $R are in real definitely useless. So you could remove ,$R from this command line as that is of no use.

                    $(COPT) references the string assigned to variable COPT defined in section [Variables]. The string assigned to COPT is the string entered by you in the Compiler Options window for Compiler Options. You have not defined any compiler options at the moment. You should know what to enter here after reading the documentation of cobol.exe or its usage information output in command prompt window.

                    You have not defined any compiler options at the moment. You should know what to enter here after reading the documentation of cobol.exe or its usage information output in command prompt window.

                    It could be that the command line part COBOL $I,$O must be modified to Cobol.exe $I -O$O or something similar. But I cannot tell you what is the right arguments list for cobol.exe because of missing documentation / usage information of this executable.

                    cbllink.exe is executed with the warning -X:R option not available in 32 bit. So the option -X:R must be modified on running this executable. There is output next the error message that the file COBOLT~1.obj is not found which means it was not created before by the compiler cobol.exe.

                    You must modify in section [Build] the line Cmd0 which is currently Cbllink.exe $(LOPT) -O$O $FGO $FGL. I have no documentation for cbllink.exe to tell you what you must write here. I cannot run in a command prompt window C:\cobol32\exedll\cbllink.exe without any argument or with argument --help or -h or /? or -? to get output the usage information for this executable.

                    I suppose the command line itself is right. $(LOPT) references the string assigned to variable LOPT defined in section [Variables]. The string assigned to LOPT is a concatenation of the linker options selected by you in the Compiler Options window.

                    The string assigned to LOPT starts always with -X: which looks like being right in general.

                    The next character after -X: is currently L as having selected for Link With the value LCOBOL. It would be also possible that C is the next character on selecting value COLIB. What is right is explained by the documentation or usage information of the linker executable.

                    You have selected for Link For currently DOS resulting in running the linker with option character R appended after -X:L which results in the warning as this option is not suitable for running the linker in 32-bit mode. I suggest to select WINDOWS in the Compiler Options window for Link For to run the linker with W as next character. But if that is really right or not can be found out only by reading the documentation or usage information of the linker.

                    The last character appended to the linker options argument string is currently S caused by having selected no for Link in SysPrg. I have no idea what this linker option is for and what is its meaning. I would need the documentation or the usage information of the linker to be able to understand its meaning.

                    By the way: A Microsoft Word document is not an image file. Screenshots should be saved as PNG file which is an image file format supported by all applications supporting images including all web browsers. It is necessary to have an application installed supporting the DOCX format to be able to view an image embedded into a Microsoft Word document. A PNG file can be opened on any Windows by double clicking on it as every Windows has at least one application installed by default supporting PNG images. But better would have been in this case to right click into the Output Window of UEStudio and click next with left mouse button on context menu item Copy to clipboard to copy the entire text in the output window to clipboard to paste it for example into edit window of the browser as text.
                    Best regards from an UC/UE/UES for Windows user from Austria

                    16
                    Basic UserBasic User
                    16

                      Dec 21, 2020#10

                      Mofi

                      Thank you for that. I will read carefully and get back to you. You asked for some MF documentation. Here are the relevant links (they are for a different MF product but the command line information is the same as for my compiler):

                      Compiling from the command line - the cobol command
                      https://www.microfocus.com/documentatio ... OML17.html

                      Linking from the command line - cbllink
                      https://www.microfocus.com/documentatio ... OML02.html

                        Dec 21, 2020#11

                        Mofi

                        I've made changes to the Project Settings as you suggested. The output seems to be calling cobol.exe and cbllink.exe correctly, but coboltest.obj is not created (no file of this name on my laptop) hence "Cannot open file: COBOLtest.obj".

                        Code: Select all

                        --------------------Configuration: COBOLtest - Debug--------------------
                        COBOL.exe ..\COBOLtest.cbl,COBOLtest.obj
                        Cbllink.exe -X:LS -OCOBOLtest.EXE COBOLtest.obj
                        Micro Focus COBOL - CBLLINK utility
                        Version 4.0.38 Copyright (C) 1993-1998 Micro Focus Ltd.
                        Micro Focus COBOL - CBLNAMES utility
                        Version 4.0.38 Copyright (C) 1993-1998 Micro Focus Ltd.
                        ERROR: (1) Cannot open file :  COBOLtest.obj
                        ERROR: (6) No public symbols found. No object file generated
                        ERROR: (9) Program indicated failure
                        COBOLtest.EXE - 3 error(s), 0 warning(s)

                        6,685587
                        Grand MasterGrand Master
                        6,685587

                          Dec 22, 2020#12

                          Thanks for the links to the documentation of the Micro Focus COBOL compiler and linker which makes it much easier for me to help you creating the compiler configuration for compiling COBOL source files to an application.

                          There is attached a ZIP file containing the application configuration written by me now after reading the documentation at least for usage of the two executables from command line which of course is done by UEStudio on compilation of a project file or on build of the entire project.

                          Extract the file in the ZIP file to folder C:\workarea\cobol32\coboltest\Configs\COBOL Compiler and overwrite the existing file with name Application.

                          Then start UEStudio, click in menu Build on first item Set Compiler Options, click in opened window on button Default and then look on the options in the Compiler Options window. You can see that I made many changes as I removed all not suitable options and added instead most options which can be used with cobol.exe and cbllink.exe with their descriptions as user information for building a project to an application. It should not be necessary to modify any option. So just close the window after clicking on button Default with a click on X symbol.

                          Now it should be possible to build your project. I could not really test that as I don't have the two executables and I don't have a COBOL source code file, but the make file is generated correct according to my understanding of the Micro Focus COBOL compiler documentation and the two executables are correct executed by UEStudio.

                          Please note that I have selected in Compiler Paths dialog window for COBOL Compiler the path C:\cobol32 resulting in CPATH being defined in the configuration file also with C:\cobol32. That is better after reading the Micro Focus documentation about Environment variables to define the environment variables LIB, INCLUDE and PATH correct. However, it looks like those environment variables are set by the installer of Micro Focus COBOL compiler with persistent storage in Windows registry for system which means the environment variables should be all defined already on starting UEStudio which means further that they are defined all also on running the two executables.

                          I wonder myself how Micro Focus handles the situation that a user installers another compiler which defines the same environment variables also as system environment variables. In general it is no good idea to define environment variables needed by a compiler as system or user variable as that causes always troubles for the user who installs more than one compiler doing that. The environment variables as listed on the documentation page should be defined in local environment before starting a compiler executable which UEStudio does as long as the section [Environment] is correct configured by the creator of the compiler configuration.

                          Please let me know if the build process works now with this configuration without or with changing an option or if it still fails. The compiler cobol.exe should create now the object file(s) because of the semicolon at the end.

                          I would create also the Micro Focus configuration for creating a dynamic library if that one for the application works. There are only a few options for linker to change in the configuration to produce a DLL instead of an EXE. My goal is to create all files for Micro Focus COBOL compiler with your help for easy usage without any deep knowledge on the configuration and build process and send it to IDM support for being included in UEStudio v21.00 next year. I have never done this before for a compiler not installed at least temporarily, but there are not many options in comparison to other compilers which have dozens of options.
                          MicroFocusApplicationConfig.zip (1.69 KiB)   0
                          The ZIP file contains the second version of the application configuration for Micro Focus COBOL compiler.
                          Best regards from an UC/UE/UES for Windows user from Austria

                          16
                          Basic UserBasic User
                          16

                            Dec 23, 2020#13

                            Mofi

                            Thanks for the updated Application. Unfortunately I still get this:

                            Code: Select all

                            --------------------Configuration: COBOLtest - Debug--------------------
                            cobol.exe ..\COBOLtest.cbl,COBOLtest.obj,, ;
                            cbllink.exe -oCOBOLtest.EXE COBOLtest.obj
                            Micro Focus COBOL - CBLLINK utility
                            Version 4.0.38 Copyright (C) 1993-1998 Micro Focus Ltd.
                            Micro Focus COBOL - CBLNAMES utility
                            Version 4.0.38 Copyright (C) 1993-1998 Micro Focus Ltd.
                            ERROR: (1) Cannot open file :  COBOLtest.obj
                            ERROR: (6) No public symbols found. No object file generated
                            ERROR: (9) Program indicated failure
                            COBOLtest.EXE - 3 error(s), 0 warning(s)

                            6,685587
                            Grand MasterGrand Master
                            6,685587

                              Dec 23, 2020#14

                              Well, the command lines look correct according to documentation. I cannot really further help you without having the compiler installed on my computer and your source code file COBOLtest.cbl.

                              Have you ever compiled your source file successfully with cobol.exe manually from within a command prompt window?

                              I recommend to compile your COBOL source file once manually from within a command prompt window. Run in the command prompt window the following commands:

                              Code: Select all

                              set "PATH=C:\cobol32\exedll;%PATH%"
                              set LIB=C:\cobol32\lib
                              set INCLUDE=C:\cobol32\lbr
                              cd C:\workarea\cobol32\coboltest\Debug
                              cobol.exe ..\COBOLtest.cbl,COBOLtest.obj,nul,nul ;
                              dir
                              There should be a file name COBOLtest.obj output by the last command line. Otherwise cobol.exe did not compile the file COBOLtest.cbl in parent directory. I would suspect in this case an error message.

                              It could be that the file COBOLtest.obj is created by cobol.exe in a different directory than the current directory although that would be really strange. But you can find that out by running in the command prompt window:

                              Code: Select all

                              dir C:\COBOL*.obj /A-D /B /S
                              That command line searches in all directories on drive C: for a file with file name starting with COBOL and having the file extension OBJ.

                              Is there a file found? Yes, where is it found?

                              No, you need to find out why cobol.exe does nothing, not even printing a warning or an error on execution. Run in this case in same command prompt window the two command lines:

                              Code: Select all

                              cobol.exe ..\COBOLtest.cbl;
                              dir
                              Is the file name of the object file output by command DIR?

                              No, please contact support of Micro Focus and ask how to compile your COBOL file with cobol.exe with providing your file COBOLtest.cbl and your environment (the folder paths).

                              Yes, there is now an object file. Then we need to find out why the previous command line does not work. The syntax is very unusual. A comma is interpreted by Windows command processor like a space character outside a double quoted argument string and therefore replaced by a space character. It is perhaps necessary to specify the argument string enclosed in double quotes although no cobol.exe example in the documentation shows them. So run next in command prompt window:

                              Code: Select all

                              del /Q *.obj
                              cobol.exe "..\COBOLtest.cbl,COBOLtest.obj,nul,nul ;"
                              dir
                              Is the file name of the object file output again?

                              By the way: What is written into the file Variables.txt created on your desktop on opening a new command prompt window from Windows desktop and run the following command line?

                              Code: Select all

                              set >"%UserProfile%\Desktop\Variables.txt"
                              I am mainly interest in the environment variables PATH, PATHEXT and all the environment variables listed on Micro Focus documentation page about the environment variables defined by the installer of the Micro Focus COBOL compiler.
                              Best regards from an UC/UE/UES for Windows user from Austria

                              16
                              Basic UserBasic User
                              16

                                Dec 23, 2020#15

                                Mofi
                                 
                                Yes, I have compiled and linked successfully using a Command Window (opened as Adminstrator) in the coboltest directory. I use 2 batch files both of which are placed in the coboltest directory
                                compile.bat:
                                set path=c:\cobol32\exedll;                                     <--- these are MF environment variables pointing to
                                set cobdir=c:\cobol32\lbr; c:\cobol32\exedll;     <--- the compiler and linker and any other files needed
                                set lib=c:\cobol32\lib;                                                 <---

                                cobol coboltest.cbl

                                link.bat
                                cbllink coboltest.obj

                                This is what shows when I run compile.bat, link.bat and coboltest.exe:

                                C:\WORKAREA\COBOL32\COBOLtest>compile

                                C:\WORKAREA\COBOL32\COBOLtest>cobol coboltest.cbl
                                Micro Focus Object COBOL (32-bit)
                                Version 4.0.38 Copyright (C) 1984-1998 Micro Focus Ltd.
                                URN OXCNM/000047913
                                Object file-name [COBOLTEST.OBJ]:
                                Source listing   [NUL]:
                                Object listing   [NUL]:
                                * Checking complete with no errors - starting code generation
                                * Generating COBOLTEST
                                * Data:         560     Code:        1221     Literals:         536

                                C:\WORKAREA\COBOL32\COBOLtest>link

                                C:\WORKAREA\COBOL32\COBOLtest>cbllink coboltest.obj
                                Micro Focus COBOL - CBLLINK utility
                                Version 4.0.38 Copyright (C) 1993-1998 Micro Focus Ltd.

                                Micro Focus COBOL - CBLNAMES utility
                                Version 4.0.38 Copyright (C) 1993-1998 Micro Focus Ltd.

                                Microsoft (R) 32-Bit Incremental Linker Version 2.50
                                Copyright (C) Microsoft Corp 1992-94. All rights reserved.

                                coboltest.obj
                                cbllds.obj

                                C:\WORKAREA\COBOL32\COBOLtest>coboltest  <--- the .EXE file created
                                in main program,
                                            value of global counter = 0001
                                            value of 'local-item' = aaaaaaaaaaaaaaaaaaaa
                                calling nest1
                                 in nest1,   adding one to counter 
                                                    value of local-item = bbbbbbbbbbbbbbbbbbb
                                ----- and other further displays etc

                                As you can see the batch files successfully compile and link and create the .exe file. I have attached Variables.txt as requested.
                                Variables.txt (3.72 KiB)   0

                                Read more posts (11 remaining)