Browse all forums dedicated to the Rocket® COBOL product family.
Recently active
Problem: Example of how the Java Native Interface can be used to call a Net Express COBOL DLL. Resolution: BUILD W/RELEASE: Net Express v3.1 SP1 or later =========== Net Express v4.0 Sun JDK v1.3.xx INTRODUCTION ========== Example of how the Java Native Interface can be used to call a Net Express COBOL DLL. SOURCE FILES: ========== Program Files Description ---------------- ----------------------------------------------------------- HelloWorldImp.cbl Copy Files: ---------------- ------------------------------------------------
Problem: Trying to run a batch file from within a Net Express project. In this example, the batch file contains calls to mfsort. From the command line this all works fine but this does not work from within the IDE. Resolution: Not able to run a bat file directly from a project but there is a possibility to add it as a tool. For example: 1. Click on the Options menu/Customize IDE/Tools 2. Click on "New Tool" and type in a name for the tool, e.g. MFSORT 3. In the "command" field type in the path and name of the bat file, e.g. C:\\tools\\mfsort.bat 4. Click OK to save and then select "Tools" from the IDE menu. 5. Find MFSORT and click on it and the bat file should run. Old KB# 4372
Problem: Coding a DECLARATIVE section within a COBOL program. Resolution: A useful feature of the COBOL language is the DECLARATIVE section. This section can be used to handle I/O errors when they occur rather than checking the status code after each I/O statement. The following source sample illustrates how to code a DECLARATIVE. select testfile assign "testfile.dat" organization line sequential. fd testfile. 01 tf-record pic x(80). procedure division. declaratives.  
Problem: When trying to remote debug for UNIX from Net Express4.0, at first there is a message "Connecting to the remote machine means that you can view and edit breakpoints" but it appears that actually edit breakpoints cannot be edited. Why is that? Resolution: Problem is that there is the need to have the .idy files locally available to Net Express. If there is no idy at Net Express project, the remote animator can run, but won't give back the option to edit breakpoints. Old KB# 4387
Problem: This problem applies to Net Express 4.0. Resolution: Using XML PARSE and encountering xml-code 200, there is the need to apply All Websync WrapPack v4.0.007 (all07n40.exe) or higher. XML PARSE was returning the wrong xml-code for miscellaneous XML document parsing errors. It should have been returning xml-code 201. Old KB# 4392
Problem: It is generally considered good practice in COBOL to use explicit scope termination statements such as END-IF and END-EVALUATE. Resolution: Using the IMPLICTSCOPE directive to accomplish this. The program:- $set NOIMPLICITSCOPE WARNING(3) working-storage section. 01 ws-data pic x(10). procedure division. start-section section. evaluate true when ws-data = "hhh" continue
Problem: This demo illustrates how to access multiple databases from a single cobol program. The databases are DB2 and Sql*Server. The concept is to use named connections and the SET CONNECTION statement. At the beginning of your program a connection to each database is established. Each CONNECT statement specifies the AS clause which associates a user-defined name to the database connection. When access to a specific database is required the SET CONNECTION statement is issued specifying the name associated with the desired database. All subsequent SQL will access this database until another SET CONNECTION statement is issued. Resolution: BUILD W/RELEASE: Net Express 3.1 The program will prompt you to enter your db2 datasource name, your db2 userid and password, your sql server datasource name and your sql server userid and password. The format for the userid and password is userid.password. If no password is required than merel
Problem: Release: 5.0 .NET / Visual Studio 2005 How to change the Height and Width of a Form at runtime? In a .Net WinForms application there is a possibility to override the defined form size in the Form_loading event that is triggered when a Form is loaded. Resolution: An example is attached that shows how to do this. The project is Visual Studio 2005/Net Express 5 based. In the code there is the need to create an instance of System.Drawing.Size class and pass this to the Form using code such as:- repository. interface S-ComponentModel-IContainer as "System.ComponentModel.IContainer" class System-Windows-Forms-Form as "System.Windows.Forms.Form" class System-ComponentModel-Container as &q
Problem: Apartment threaded COM DLLs built with Interface Mapper not linking with multi-threaded runtime. This is an issue in Net Express 4.0 which is resolved in Net Express 5.0. Resolution: Building an apartment threaded COM DLL using the Interface Mapping Toolkit, the DLL will not be linked to use the multi-threaded COBOL runtime. This is a problem if the client program using a COM DLL is not COBOL, in which case the single-threaded runtime may get loaded. It can also be a problem if the COM DLL code calls any other COBOL programs that are linked to use the multi-threaded runtime. To resolve this, there is the need to edit the deploy.mfscript file located in the NetExpress\\base\\bin directory. Scroll to the bottom of this file where to see <package name="createdll" extension="dll">. Below that, seeing <preoption>-Re</preoption> which can be changed to <preoption>-Rm</preoption>. Save the file and
Problem: Demonstrates the use of the .NET Platform Invoke functionality in order to use the COBOL CALL statement to call entry points and functions within unmanaged Windows dynamic Link Libraries created with Net Express 4.0, Microsoft Visual C/C 6.0 and also to call Windows system API functions. This program also demonstrates the use of the new .NET COBOL structured exception handling syntax to catch run-time exceptions and also shows how to create and use a user-defined exception class. Resolution: BUILD W/RELEASE: Net Express 4.0 with .NET add-on installed. The 'CallUnmanagedDll.zip' file actually contains three different projects which can all be extracted into a single folder on your hard disk. You can create a folder such as 'C:\\CallUnmanagedDll' into which you can extract the entire contents of the zip file, including the subfolder structures '.\\bin\\debug' and '.obj\\debug'. The main source program withi
Problem: This demo shows how you can use ActiveX Data Objects (ADO) from a Net Express application. For more information on the Methods/Properties and events being used here please see the Microsoft Platform SDK documentation:- http://msdn.microsoft.com/library Resolution: BUILD W/RELEASE: Net Express V3.1 and MDAC 2.5. In order to use this demo you need to have the Microsoft Data Access componants (MDAC) installed. This is available for download at http://www.microsoft.com/data/ This demo has been written and tested using Net Express V3.1 SOURCE FILES: ========== Program Files Description ---------------- ----------------------------------------------------------- ADOData Main ADO Sample Code A DOEvents ADO COM Event
Problem: A table in XDB has a column with the same name as a reserved word (ex: delete) Using a select statement in your COBOL program like: SELECT delete FROM mftest will get a compiler error: COBES0100S Incorrect SQL statement syntax near DELETE Resolution: In the SELECT statement to qualify the column with the table name should resolve this issue: SELECT mftest.delete FROM mftest Esp. using SQLSERVER to enclose the column names in square brackets: SELECT [delete] FROM mftest Old KB# 4379
Problem: This example demonstrates how to create Windows 32-bit .DLLs from a COBOL program which can be called by a Microsoft Visual Basic program. It also demonstrates how and when to use static and dynamic call-conventions and how to link .DLLs to the Net Express file handler MFFH.OBJ. Resolution: BUILD W/RELEASE: 3.1 INTRODUCTION ========== This example demonstrates how to create Windows 32-bit .DLLs from a COBOL program which can be called by a Microsoft Visual Basic program. It also demonstrates how and when to use static and dynamic call-conventions and how to link .DLLs to the Net Express file handler MFFH.OBJ. The project actually consists of a Visual Basic main program called DEMO1.EXE and a number of Net Express generated .DLLs. DEMO1.EXE displays a single form which interacts with the user. The form contains a number of buttons each of which when pressed will load a COBOL.DLL and call an entry
Problem: This demo shows how to generate and animate a dump file using the CBLCORE utility See also KB article 23217 for details of doing this using the core_on_error runtime tunable. Resolution: BUILD W/RELEASE: Net Express v4.0 including ALL03N40 WrapPack. SOURCE FILES: ========== Program Files Description ---------------- ----------------------------------------------------------- CBLCORE.CBL Test program that will cause a runtime 114 error Resource Files: ---------------- ----------------------------------------------------------- DOIT.BAT Bat file OPERATION: ======== From a NetExpress Command Prompt execute the included BAT file, doit.bat. This bat file compile for animation and link the test program then it will execute the CBLC
Problem: This demo shows how you can communicate to a Java Server program using TCP/IP. Resolution: BUILD W/RELEASE: Net Express 4.0 INTRODUCTION ========== This demo shows how you can communicate to a Java Server program using TCPIP. The client COBOL module uses the JAVA/COBOL support to call a Java module that does the comms to the server java program. SOURCE FILES: ========== Program Files Description --------------------- --------------------------------------------------------- TCPServer.java Java Server program UseJavaSockets.cbl COBOL Client program that calls java. SocketClient.java Java client module that performs the comms with the server. REQUIREMENTS: ========== T
Problem: Release: Net Express 5.0 Consuming from a jsp and a Servlet, deployed on TOMCAT 5.0.28, a Java Bean generated by MF Interface Mapping Toolkit (IMTK) which, thru J2SE, invokes a Service deployed on Micro Focus Enterprise Server Resolution: ============================================ The step of Micro Focus Knowledge Base article 23173 was about consuming a bean generated by Micro Focus Interface Mapping Toolkit by a sample JAVA client launched under a JVM ( ie: java client ), this Bean generated by MF Interface Mapping invoking thru J2SE a Service deployed on Micro Focus Enterprise Server. KB 23173 Sample JAVA J2SE sample which invokes a service deployed on MF Enterprise Server http://supportline.microfocus.com/mf_kb_display.asp?kbnumber=23173 ============================================ The present STEP is about consuming the Bean above generated by
Problem: Sometimes there is a need to display the day of the week from a COBOL program. Resolution: The following code sample shows a way of calculating the day of the week from any given date. The date needs to be in the format YYYYMMDD. working-storage section. 01 ws-weekdays pic x(21) value "SunMonTueWedThuFriSat". 01 ws-week-day redefines ws-weekdays occurs 7 times. 01 ws-date pic 9(8) value 0. 01 ws-day pic 9(1) value 0. ...
Problem: Often there is a need to read and set operating system environment variables from COBOL programs. How can this be done? Resolution: Micro Focus COBOL provides syntax that permits the reading and setting of environment variables within the Windows system. Please note the following points though: 1) Creating/changing the value environment variable it will only remain current for the duration of the COBOL run unit. Other applications will still see the original setting. 2) To call MFEXTMAP to enable the setting of environment variables. 3) To use ON EXCEPTION to test for errors when manipulating environment variables. The following example illustrates the syntax required to manipulate an environment variable valled TESTENV: $set xopen working-storage section. 01 ws-env &n
Problem: C and COBOL, 32bit, mixed language application interface examples Resolution: C calling COBOL ------------------- The COBOL program must be completed first to provide an import library needed to complete the C program. Use the CASE compiler directive. This will preserve the mixed case function names. Specify call-convention 74. This is a Windows 95/NT Standard call. It corresponds to APIENTRY. A call-convention specified in the procedure division header applies equally to each entry statement in the procedure division. C integer items are 32bits, pic xxxx usage comp-5. C character strings are null terminated, z'STRING' or 'STRING' & x'00'. Numeric values, integers and longs, are passed/received by value. Character strings and records (structures) are passed/received by reference. Compile and link the COBOL program from the command line as follows: cbllink -v -k -l -d -FS C2CBLDLL.CBL The -v switch i
Problem: Often there is a need to be able to calculate the length of data within a COBOL string (PIC X). Resolution: There are many ways to calculate the length of data within a COBOL string variable. The following method is simple and hopefully easy to understand. The code basically does the following: 1) It reverses the string using the REVERSE Intrinsic function. 2) The INSPECT verb is used to count the number of leading spaces. 3) The number of leading spaces is subtracted from the total size of the variable. Here is a small example that illustrates the idea: working-storage section. 01 ws-string pic x(40). 01 ws-string-len
Problem: Is it possible to create Adobe PDF files from COBOL? Resolution: COBOL does not have any specific support for creating PDF files. However, using the PC_PRINT functions under Windows there is a possibility to utilise a PDF print driver. There are a number available including the one from Adobe. When installed, these simply offer PDF as one of the "Printers". The COBOL program can select this and generate a PDF file from the printed output. One such driver can be located at: http://www.pdfcreator.de.vu/ Micro Focus is not recommending the above and has not tested the driver with its products. We have no association with the creator of the driver and no warranty is expressed or implied. Old KB# 4369
Problem: There may be times when you need to coordinate work between multiple instances of a process that are sharing a resource. One process will use the resource while another waits for access to that same resource. To do this, you can use the CreateMutex and WaitForSingleObject Win32 API functions. Resolution: We can use the CreateMutex Win32 API function to protect a shared resource from simultaneous access by multiple processes. Each process must wait for ownership of the mutex before it can execute the code that accesses the shared resource. See the comments in the source files of the attached demo for details. Additional details of these functions can be found at http://msdn.microsoft.com/library/ Attachments: Mutex.zip Old KB# 4289
Problem: When installing Net Express 5.0, getting the message "Installer terminated prematurely" at the step "deleting services". Resolution: If a previous uninstallation of Net Express was not done completely, Micro Focus Directory Service (MFDS) may not be uninstalled. Please reboot the PC and try again. The reboot may take a while longer than usual when the operating system removes the no-longer existing service. Old KB# 4323
Problem: An HTML - Form with Disabled Input Fields does not return the values back as expected. When sending the form the data in the disabled input fields are displayed normally. After submitting the data however these fields with ACCEPT HTML-FORM are not returned back. Why is this? Resolution: The reason this is happening is that Disabled fields do not return any value to the server. Therefore the form fields get 0. (not the data expected). See for further explanation: http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.12.1 Old KB# 4297
Problem: Release: 4.0 Beim Starten des COBOL-Programms wird folgender Fehler gemeldet: Der Prozedureinsprungpunkt "CBL_CTF_TRACER_GET" wurde in der DLL "cblrtss.dll" nicht gefunden. Was könnte das Problem sein? Resolution: Die gefundene Laufzeitumgebung passt nicht zum Compiler, mit dem das Programm übersetzt wurde. Bitte stellen Sie dem Programm neben der aktuellen Entwicklungsumgebung die passende Laufzeitumgebung (Runtime) zur Verfügung. Die aktuellen Versionen sind: all08n40.exe für die Entwicklungsumgebung / aps10a40.exe für den Application Server (Runtime) Old KB# 4305
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.