Browse all forums dedicated to the Rocket® COBOL product family.
Recently active
Problem: This illustrates accessing the Windows registry with COBOL and writing or reading information from the registry Resolution: INTRODUCTION ========== This example demonstrates the use of the Win32 API function calls to access and create system Registry entries from within a COBOL program. In this example, we will create a new Registry key called "TestKey" which is a subkey of the Windows standard HK_CURRENT_USERS key. It will then create a null terminated string value name for this key and populate it with a value. It will then close the Registry, reopen the key, read the keys value and display the value to the user. You can check this keys existance after running this program by using the Windows program REGEDIT to view the Registry. SOURCE FILES: ========== Program Files Description ----------------- ----------------------------------------------------------- COBREG.CBL&
Problem: This shows how to get the details of the currently logged on users using Win32 API functions Resolution: INTRODUCTION ========== This program demonstrates using windows api calls to get computer name and user name. Place a brief description of the sample SOURCE FILES: ========= Program Files Description ---------------- ----------------------------------------------------------- getuser.cbl Program that makes win32 api calls to get the computer name and user name. Copy Files: ---------------- ----------------------------------------------------------- miniwin.cpy copybook needed to use the winapi calls. wintypes.cpy copybook needed to use the winapi calls. REQUIREMENTS: ========== Install the win32 sdk from the netexpress 3.1 cd-2
Problem: This example illustrates how to use the Windows MessageBox API function to display information for an application user. Four different techniques are described. Eight significant features are demonstrated: - call-convention, - COBOL Call Prototypes, - Constant Compiler directive, - Conditional Compilation, - Level 78 items, - z'literal', - procedure-pointer items, - set ... to entry ... statements. Resolution: INTRODUCTION ========== This example illustrates how to use the Windows MessageBox Api to display information for an application user. Four different techniques are described. Eight significant features are demonstrated, call-convention, COBOL Call Prototypes, Constant Compiler directive, Conditional Compilation, Level 78 items, z'literal', procedure-pointer items, and set ... to entry ... statements. There are five projects in these four directories: - cc66\\Cob32api\\MessageBox66
Problem: WSDL syntax ( WSDL tutorial: http://www.w3schools.com/wsdl/default.asp ) allows a WSDL file to have more than one WSDL tag <port > and <binding > and <portype > . Unfortunately, at the time this article was written, the Micro Focus tool ( Net Express menu bar->Service->Generate Client->using WSDL), Our Web Service Client 'generator' , only uses one port (the first one) and includes all operations within the binding for that port. How to you create, in the Cobol Web Service Client, ALL THE OPERATIONS defined in the .WSDL which has multiple <port > & ...? You'll have to modify the .WSDL so it just uses ONE <port > and <binding > and <portype > tags. Enhancement request have been raised so the MF tool, our Web Service Client 'generator', can consume WSDLs using multiple <port > and <binding > and <portype > tags. These should be included
Problem: Reading data from the COM port using WIN 32 APIs/Sending data to the COM port using WIN 32 APIs Resolution: INTRODUCTION ========== This example program demonstrates how to access the systems Serial communications ports using Windows API function calls. Two projects are used in this example. SENDCOM wants to send some data to whatever is connected to COM1. It starts by sending a message to the device to get its attention. READCOM then responds with a short "OK" message and then receives (without any response) whatever is sent by SENDCOM. SENDCOM ends the connection by sending a final "finish" message which, when received, causes READCOM to terminate. SENDCOM terminates after sending the finish message. SOURCE FILES: ========== Program Files Description ------------------- ----------------------------------------------------------- SENDCOM .CBL
Problem: This example demonstrates the use of the two Win32 API functions WNetGetUser to retrieve the name of the user who is currently logged on, and WNetAddConnection2 to verify a specified password against a network servers password file for the current user. Resolution: INTRODUCTION ========== This example demonstrates the use of the two Win32 API functions WNetGetUser in order to retrieve the name of the user who is currently logged on, and WNetAddConnection2 in order to verify a specified password against a network servers password file for the current user. These routines allow you to use the Networks password authentication routines so that you can use the same network user names and passwords as security to your own application. You pass a network machine name, a username and a password to the WNetAddConnection2 function and it will attempt to log the specified user on to the network machine name provided. A return code is returned which indicates
Problem: This example illustrates how to use Win32 Api functions to search a directory. File and directory attributes are interpreted and displayed. Resolution: INTRODUCTION ========== This example illustrates how to use Win32 Api functions to search a directory. File and directory attributes are interpreted and displayed. SOURCE FILES: ============= Program Files Description -------------------- ----------------------------------------------------------- FindFile.cbl Application program Win32 Api Functions ============ FindFirstFile FindNextFile FileClose FileTimeToLocalFileTime FileTimeToSystemTime PROGRAMMING: ==========
Problem: This shows how to find free disk space on a drive using Windows API calls Resolution: INTRODUCTION ========== Find Free Disk Space on a Drive using Windows API calls SOURCE FILES: ========== Program Files Description ---------------- ----------------------------------------------------------- diskinfo.cbl Main program for sample Copy Files: ---------------- ----------------------------------------------------------- miniwin.cpy winerror.cpy wintypes.cpy OPERATION: ======== Open project and rebuild application ========================================================== Keywords: demonstration, sample, example, demo, win32 api, freediskspace.zip demo.ex demo.ne Attachments: freediskspace.zip Old KB# 4170
Problem: GetSystemMetrics is an API that can be used to collect details from Windows. In this example it is collecting the resolution currently in use. Resolution: INTRODUCTION ========== GetSystemMetrics is an Api that can be used to collect details from Windows. In this example it is collecting the resolution currently in use. SOURCE FILES: ========= Program Files Description ---------------- ----------------------------------------------------------- GSM.CBL Copy Files: ---------------- ----------------------------------------------------------- GSM.CPY REQUIREMENTS: ========== Ensure that the USER32.LIB is linked with the EXE. NOTE: ==== For details on the parameters that can be retrieved by this call go to http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/sysinfo_8fjn.asp ==================================================
Problem: Does POWER TERM use SSH? Resolution: PowerTerm supports both SSH-1 and SSH-2 standards (Secure Shell security). For additional information on this 3rd party piece of software you may like to take a look at the Ericom web site. Please note that this is not a MF product; we just package it with Net Express. Old KB# 4114
Problem: Can the Acrobat reader be launched for a PDR file from Net Express COBOL? Resolution: Yes - use the WinApi ShellExecute. A demo for ShellExecute can be found at our samples page in the Internet: http://supportline.microfocus.com/examplesandutilities/nesamp.asp#Win32API It demonstrates how to launch the Internet Browser for an HTML-file. Changing the name of the HTML-file to the name of the PDF-file will start the Acrobat reader. The ShellExecute expects a zero-terminated filename, e.g. by z" ". Old KB# 4052
Problem: With Unix filenames/sourcenames are case-sensitive. With Net Express you could write: CALL "Great" and GREat.int will be found How does this work on Server Express? Is there a directive you can use to have the same behaviour? Resolution: On a UNIX system one can only have upper or lower case. A 'mixed' name in upper & lower case letters will not work. e.g.: GREat.int. This is related to the Operating System. Windows can handle this without problem but not UNIX. There is a directive FOLD-CALL-NAME (FOLDCALLNAME without hyphen works as well). This compiler directive allows lower- or upper case. But not a mixture. Old KB# 4108
Problem: Are ISO2002 User Defined Funtions supported in Net Express V3.1? Resolution: ISO2002 User Defined Funtions are NOT supported in V3.1 of Net Express. To use this functionality you need to use V4.0 or above. Old KB# 4046
Problem: While debuging, if I want to have a look at the contents of a field, I press "q" then followed by "c". However, if I want to have a look at the contents of an array, I am having problems finding the keys that allow me to "scroll" up/down the array contents. Resolution: To view the contents of an array, place your cursor over the group item of the array, by going to the working storage of the array and then press "q" followed by "c". Next press "F5" / "F6" to step down / up through an 'OCCURS' field of a group item. "F8" will take you to the child of that group item, that is, the data element of that level. "F9" will take you to next data element of the same level. "F7" will take you back to the group item of the child. Old KB# 4117
Problem: You may find that this information may be missing in your version of the documentation. The "What is new" section says that the search order has changed since Server Express 2.2, but the search order that is actually taking place hasn't been detailed within the chapters that talk about the file handler configuration. Resolution: Currently (Server Express 4.0 and 5.0) the file handler searches for the configuration file in this order: 1. It checks for an environment variable named EXTFH. If the environment variable value is not equal to a space, it attempts to open that file. 2. Otherwise, it tries to open using "$COBDIR/etc/extfh.cfg". 3. If that fails, it tries to open "extfh.cfg" in the current working directory. 4. Finally, if that fails, it assumes that there is no configuration file and it takes all the default values for each one of the options. Old KB# 4107#netexpress#ServerExpress#COBOL#RMCOBOL#AcuCobo
Problem: In a .NET Cobol program which creates and prints a Word document, how do I set the ActivePrinter property from within the Cobol program to select the printer I require? Resolution: You can use the OLE Object, e.g. a Word document, to set the printer settings. Have a look at the attached demo for how to get the name of the default printer using the ActivePrinter property. The commented out lines in the code will change the printer name. Attachments: test1_1403.zip Old KB# 4056
Problem: Error occurs when creating an executable linked with Oracle 9.x compile using Server Express 4.0 on HP/UX 11.11 platform Precompiling xxx005u.pco cob -C IBMCOMP -C NESTCALL -t -x -o xxx005u xxx005u.cob -L/oracle/product/920/lib/ /oracle/product/920/precomp/lib/cobsqlintf.o -lclntsh 'cat /oracle/product/920/lib/ldflags' 'cat/oracle/product/920/lib/sysliblist' -lm -lpthread -lpthread* Ignored - NESTCALL cob64: invalid symbol __iob in sidefile /opt/microfocus/cobol/lib/cobisym *** Error exit code 1 Stop. RXCPR/AAD:9i.T4.40.04 PTI=SP2 Resolution: The error is the result of mismatched definition of environment variables for Server Express 4.0 COBDIR=/opt/microfocus/cobol - the default for Server Express 4.0 PATH set to include the bin directory of an earlier version of Server Express d
Problem: Opening a line sequential file in EXTEND mode will put an exclusive lock on that file by default. In this case, you can't open that file with a Windows utility such as Notepad to view it until the file has been closed. Resolution: To get around this, you can code the "sharing with all other" phrase in the select statement: select logfile assign to "logfile.txt" organization is line sequential sharing with all other. Old KB# 4047#ServerExpress#AcuCobol#RMCOBOL#netexpress#COBOL
Problem: This program demonstrates the use of the Net Express library routine PC_PRINTER_INFO to get the current configuration information for a specified open printer. It will return a native device context handle, and other information that can be used to enhance the printing of a document by calling native WINAPI graphics functions directly. Resolution: INTRODUCTION ========== This program demonstrates the use of the Net Express library routine PC_PRINTER_INFO to get the current configuration information for a specified open printer. It will return a native device context handle, and other information that can be used to enhance the printing of a document by calling native WINAPI graphics functions directly. SOURCE FILES: ========= Program Files Description ------------------- ----------------------------------------------------------- PRNTINFO.CBL
Problem: The following error message is returned when compiling: /opt/lib/cobol/bin/rts64_t: /sbin/loader: Fatal Error: Cannot map library libcobrts64_t.so.2 Resolution: Make sure the environment variable LD_LIBRARY_PATH (or LIBPATH on AIX & SHLIB_PATH on HP-UX) is set correctly by pointing to the correct product and location. It should be set to the $COBDIR/lib directory. To check what the environment variables are set to, run the 'env' command or the 'mfsupport' command, which will generate a 'mfpoll' file in the same directory you run the command. Old KB# 4086
Problem: A customer's application deletes a record from an index file via COBOL. The record is ".. Not Found" when reading the file. When dumped using 'od' the record data can be seen to still exist in the file. So how can one delete a record physically from an index file using a COBOL program? Resolution: When you delete a record the file handler marks in the data file and index that the record is deleted - it doesn't physically write over the record. You would have to rewrite the key with spaces in the record area and then delete it to remove the data but of course the key is still there. So the only permanent way of doing this is to run rebuild which will remove all the deleted and free space records. The reason we don't permanently delete the record is entirely for performance. Old KB# 4074#ServerExpress#RMCOBOL#COBOL#netexpress#AcuCobol
Problem: A customer was required to change a single line in over 1000 programs to add text to the end of the PROGRAM-ID statement. The format of the PROGRAM-ID is : PROGRAM-ID. MYPROGNAME. The change required the format: PROGRAM-ID PROGRAMNAME IS INITIAL. They did not wish to edit each file individually. Resolution: sed is made for this sort of job. The answer is simple and very fast. #! /bin/sh for FILE in *.cbl do echo $FILE sed '/PROGRAM-ID/s/[.]$/ IS INITIAL./' $FILE > ./tmp/tmp.$FILE diff $FILE ./tmp/tmp.$FILE >>./tmp/diff.txt done The script is placed in the directory containing the .cbl files. I also create a tmp directory in the same directory. When run, the script performs a loop reading every .cbl file. It prints the filename to the screen. Edits the line containing PROGRAM-ID to remove the trailing period from the prog
Problem: Getting a 9/037 error using CBL_READ_DIR and CBL_GET_CURRENT_DIRECTORY Resolution: As the error code suggests, this is a permissions problem. The directory in question can be found using a system trace utility such as truss. In the truss trace on AIX will be something like: statx("./../../../../", 0x2FF216D8, 76, 0) Err#13 EACCES Err#13 EACCES means that search permission is denied for one component of the path prefix. The path prefix in this example is "./../../../../", i.e. 4 levels up from the directory where the program is running. Full information on statx can be found at the IBM site (http://publib.boulder.ibm.com/infocenter/pseries/v5r3/index.jsp?topic=/com.ibm.aix.doc/libs/basetrf2/statx.htm). truss is available on AIX, SCO UnixWare and Solaris. On HP systems there's tusc and Tru64 uses trace, neither of which are included in the main distribu
Problem: How to find out which version of Enterprise Link is installed? Resolution: To check which version of ELink you have installed, go to the Web Authors site and look towards the bottom of the screen. You should see something like: Micro Focus EnterpriseLink 5.0.6 Build Number 6481 on 04/06/06 19:23:36 for Microsoft Windows Old KB# 4133#EnterpriseLink#Rumba
Problem: While loading screen using either EL Loader or loader lite ther is noway to specify which protocol to use TN3270 or TN3270E but there is a option after the project is created. Resolution: At the start of loader in the information page under the category "Display Attributes" there is a checkbox "Extended mode". TN3270E is extended mode. And is this also true for LoaderLite, the "Extended Attributes" check box turns on TN3270E? Old KB# 4134#Rumba#EnterpriseLink
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.