When running batch COBOL programs our mainframe provides counts of how many times each file is written, read, etc. This logging is helpful when debugging. Can Visual COBOL Runtime provide any similar logging?
File IO Counts
Visual COBOL 2.2 Running INTs on Windows XP
Is it possible to run native INT's on Windows XP? I can run the INT on a Windows 7 box with no issues, but when I try to run the same INT on XP I get an error: run.exe is not a valid Win32 application.
Thanks!
COBOL Server 2012 Runtime - firewall issues
We installed COBOL Server 2012 Runtime on our server... it's actually a Windows 7 workstation that we use for file sharing. I am using a batch file to run native INT programs from another Windows 7 workstation in the office:
SET COBSW=/S15000+P3-F+B+C
set COBDIR=\\10.172.150.50\COBOLsrv
set PATH=%COBDIR%;%COBDIR%\bin;%PATH%
mfcesdchk.exe >nul
if errorlevel 1 goto startlic
goto startapp
:startlic
start /B mfcesd.exe -b
:checkloop
mfcesdchk.exe >nul
if errorlevel 1 goto checkloop
:startapp
cmd
run mainmenu.int
The mfcesdchk command from the workstation completes successfully and returns:
CES daemon running, version 10000.2.01443
The Windows 7 "server" is running FortiClient Firewall. We have opened port 5093 and we have set lservnt.exe to "allow" for both the private zone and public zone, but we get an error when trying to run our INT:
error code: 247, pc=0, call=1, seg=0
247 Licensing error (Error[5]: Cannot talk to the license server on host "10.172.150.50". Server may not be running.)
When we set the firewall to "Pass All" the INT runs with no issue. Is there some other port or process that needs to be opened up on the firewall for the licensing to work correctly?
Internal Sort VC2012
I have a solution in Visual Cobol 2012 naïve code that has an internal sort with input and output procedures. I do a perform thru in both procedures. When I debug the code when I go to the input procedure exit, instead of going back to the sort, the code falls thru and does not return. Ideas?
Runtime Modules Needed
I am about to install my first solution in VC 2.2. Is there a list of the MicroFocus runtime modules that need to be included with my solution?
Error Starting Program
I have a new solution that I am deploying on a server. I have installed the license and cobol server 2012. My main program is an exe that I am starting from a workstation which has access to the server thru a share. When I start the program I get the error message 'fplogin.exe has encountered a problem and needs to close'. I have run this on my laptop which I am developing the code on and it runs ok. Any ideas?
Error with Visual Studio 12 with Visual Cobol
Hi,
I started receiving error when I try to create a new project with Visual Cobol on Visual Studio 12. Trying to create Managed Windows Form project I receive Method 'Message' in type 'MicroFocus.COBOLServicesImplementations.ParseHarvester' for assembly 'MicroFocus.COBOLServices, Version 4.0.....does not have an implementation. And creating a console projects returns an exception.
License is installed and the Eclipse versions works fine.
I reinstalled multiple times and also installed updates to Visual Studio 12 but nothing solves the problem.
I run on Windows 7.
Regards
Managed Code Encoding Serial Port
Hi Community!
I have encountered a problem sending data past x"3F" over a serial port in managed code. In the docs I read you need to set the encoding to go past the 7-Bit(??) limit. So I did the following:
set serialPort1::Encoding to type System.Text.Encoding::GetEncoding(737) *> tried other values like 1252 as suggested in different forums. But when I do:
invoke serialPort1::Write(x"FF") *> it results in 3F being sent. where is Bit 8?
Somehow I don't get the catch. Should be simple though. I hope someone has an answer.
Regards
Rainer
MF Visual Cobol for Eclipse 2.2 on Linux
Hi,
I installed MF Visual Cobol for Eclipse 2.2 on Linux (centOS). License is activated and the command line compiler works fine.
After it I started eclipse, and I created a small project without any error. Debugger works also.
Then I tried to import a big project (version 2.1). It's imported without any error, but the compilation stopped.
I closed eclipse and restarted it. It does not work any more, it shows only the splash screen.
After it I renamed the workspace and eclipse new restarted. It starts but I get a java error:
"An internal error occurred during: "Initializing Java Tooling".
com/microfocus/eclipse/project/content/FileTypeHelper"
After click on OK it goes, but I can not create a Cobol Project.
Any hints or helps?
Thx - Laszlo
Connecting Visual Cobol to a Oracle database in Visual Studio 2010
Hello !
I'm using:
- Visual Cobol 2.2
- Visual Studio 2010
- 32 bits
- Oracle Client 11.2.0
The Cobol program is compiled ok.
On Project Properties, SQL, the preprocessor being used is OpenESQL and the directive SQL(DBMAN=ODBC) is set.
The driver Microsoft ODBC for Oracle is installed.
I added the connection Oracle Database (Oracle ODP.NET) and tested the connection. It's ok.
I can see the database, the tables, and access them.
But when I try to run the program I got a -19703 in this command:
EXEC SQL
CONNECT :WS-USERNAME IDENTIFIED BY :WS-PASSWD
END-EXEC.
What am I doing wrong ?
Thanks in advance and sorry for any English mistakes.
Receiving Java custom record in procedural cobol
Hi,
We want to share a Cobol Structure between our Cobol program and a new Java Program.
The Cobol program will call the Java program.
We have succeeded running simple examples exchanging simple data type beteen Cobol and Java. We have failed so far with the CustomRecord data type.
Here is our Java CustomRecord class:
import com.microfocus.cobol.lang.*;
public class TPrestInter implements CustomRecord, java.io.Serializable {
private static final long serialVersionUID = 827363353239593196L;
private long noEmployeur;
public Object[] getParameters(){
return new ParameterList()
.add(getNoEmployeur().toString().getBypes())
.getArguments();
}
public void setParameters(Object[] params) {
Byte[] byteNumeroEmployeur = (byte[]) params[0]);
setNoEmployeur (Integer.parseInt(new String(byteNumeroEmployeur));
}
public Long getNoEmployeur() {
return this.noEmployeur;
}
public void setNoEmployeur(Long noEmployeur) {
this.noEmployeur = noEmployeur;
}
}
Here is the Java class That generates custom record objects
public class LireTPrestInt {
public TPrestInter getObject(){
TPrestInter object = new TPrestInter();
object.setNoEmployeur(456L);
return object;
}
}
Here is the Cobol program
$set ooctrl(+p-f)
identification division.
program-id. Program1.
environment division.
configuration section.
repository.
class java-tprestint as "$java$TPrestInter"
class lire-tprestint as "$java$LireTPrestInt".
data division.
working-storage section.
01 obj-lire-tprest-int object reference.
01 tprest-int-struct.
03 numero-employeur pic 9(3).
01 x1 pic s9(18) comp-5.
01 x2 pic s9(18) comp-5.
01 x3 pic s9(18) comp-5.
01 x pic x(80).
procedure division.
display "Test Cobol <-> Java".
invoke java-tprestint "new" returning obj-java-tprestint.
invoke obj-java-tprestint "getNoEmployeur" returning x1.
exhibit named x1.
move 987 to x1.
invoke obj-java-tprestint "setNoEmployeur" using x1.
invoke lire-tprestint "new" returning obj-lire-tprest-int.
invoke obj-lire-tprest-int "getObject" returning tprest-int-struct.
exhibit named numero-employeur.
goback.
end program Program1.
The call to method "getObject" fails with the following exception:
Exception 65538 not trapped by the class javaexceptionmanager.
Description: "Java runtime exception"
Method 'getObject' with signature Ljava/lang/String; not found
Thanks in advance for your help.
Guy Fokou
Problem calling C program
Environment is 64-bit AIX, Visual COBOL 2.1 but compiling on the command line.
I have a simple COBOL program calling a simple C program. The COBOL program is compiled as 64-bit. The C program is, as far as I am aware, compiled as 64-bit - I have used the compilation option -maix64 and the loader option -b64. Running the program generates the error "253 Cannot load file - unsupported format". I have also tried compiling the COBOL program as 32-bit but with the same result. A previous question in the forum about this same result was apparently due to a 64-bit COBOL program calling a 32-bit C program, but I think I've eliminated that.
To eliminate anything else, I edited the two programs down to absolute basics (the return 19 in the C program is so I can check that a value is definitely being returned):
program-id. testc.
special-names.
call-convention 0 is aix-c.
working-storage section.
01 ws-name pic x(4) value "fred".
01 ws-return-val pic s9(9) comp-5.
procedure division.
a-control section.
move zero to ws-return-val
call aix-c "helloworld" using ws-name
returning ws-return-val
display "Returned " ws-return-val
goback
.
#include <stdio.h>
int
main( int argc, char **argv )
{
printf( "Hello %s\n", argv[1] );
return( 19 );
}
So have I missed something blindingly obvious?
ASCII to UTF-8 conversion and displaying in a list box
I have found that national characters like ÄÖüß and so on do not show correctly in a UTF-8 coded managed application when read from an ASCII file created by a native app.
Based on an answer I read here on encoding I came up with this code:
method-id UTF_conversion.
procedure division.
*> Specify the code page to correctly interpret byte values
set wsEncoding to type Encoding::GetEncoding(1252) *> Windows
set codePageValues to Auftragrec *> sequential file to be displayed
set n3 to codePageValues::Length *> set Original length of ASCII
set tAUFTRAGrec to Auftragrec *> save record to temporary record
*> Same content is now encoded as UTF-8
set unicodeValues to wsencoding::GetString(codePageValues)
set cAUFTRAGrec to unicodevalues *> for Display
*> Same content "äöüß" is stored as UTF-8
initialize Auftragrec
set A-Empfaenger to cA-Empfaenger *> set item containing national characters displayed in list box as only data
set Auftragpath to Auftrags-datei *> save path for temporary usage
set Auftrags-datei to Tempdatei
invoke type System.IO.File::WriteAllText(Auftrags-datei, unicodeValues)
set compareValues to type System.IO.File::ReadAllBytes(Auftrags-datei)
set n4 to compareValues::Length *> new unicode length
subtract n3 from n4 giving n2 *> add n2 to length of display item in Listbox
call "CBL_DELETE_FILE" using Auftrags-datei
returning return-code
* reset values
set Auftragrec to tAuftragrec
set Auftrags-datei to AuftragPath
goback
end method.
it is quite awkward and my question is: Can I get the new length without saving and re-reading the file? It is necessary because the national characters don't seem to be recognized as such in a list box and without setting the field length to - length + No. of national chars - the displayed fields vary in size.
I cannot just convert and save the file because when printing, the result of CHAR to OEM conversion doesn't work.
But maybe I'm just using the wrong code?
DataGridView Sort Column
I need to sort a column of datagridview object using code after to fill it.
Does anyone have any examples?
Thank you
rm/cobol to visual cobol: application windows/dialogs using rmputil
i have a program written in rm/cobol that i am trying to compile using visual cobol. i am have set the proper dialect and its compiling successfully. the problem i am facing is on the windowing system. my current program calls rmputil to create the windows and dialogs. since that is a compiled library that comes with rm/cobol (runpanel.cob, rmputil.cob, what are my options now? is there source code available so i can recompile those? or i have to rewrite all my code? and what is available in visual cobol so i can do the migration easily?
Thanks
Ali
Killing a thread
I have created a thread using the CBL_CREATE_THREAD routine. However, when I attempt to kill the thread using CBL_THREAD_KILL it does not kill the thread. The thread remains running. My thread is defined as follows
01 THREAD-StatusBar-Routine USAGE IS THREAD-POINTER.
and my call statement is
CALL "CBL_THREAD_KILL" USING BY VALUE THREAD-StatusBar-Routine Move Return-Code To Thread-Return-Code.
The return code I get is
1009 | Invalid parameter passed into a multi-threading library routine. A parameter has been detected that is not within the valid range, or that is inconsistent with the library routine. |
Also in visual studio intellisense it says can not find method CBL_THREAD_KILL with this signature. Will create dynamic call.
What am I doing wrong?
Thanks
default parameters
Is there a way to provide a default parameter in Visual Cobol like you can in C#?
public void MyString(String passedString = " ")
Cancelling a thread
I want to send a message to a thread to close and am attempting to use the CBL_THREAD_IDDATA_ALLOC and CBL_THREAD_IDDATA_GET routines. I am am getting an exception error when calling CBL_THREAD_IDDATA_GET after creating the and the intellisense is saying there is no routine with this signature. I was going by the example from the documentation. I then created a new project using the example exactly as written and I get the same error. Is there a bug in this approach?
VB to Cobol conversion
Hi,
Can any one advise how to convert the following VB code to Cobol pls.
Its for a fingerpint reader.
Imports System.Threading
Imports System.IO
Imports DPUruNet
Imports System.Drawing
Imports System.Drawing.Imaging
Imports System.Text
Public Class Verify
Private _readers As ReaderCollection
Private _reader As Reader
Private _readerResult As Constants.ResultCode
Private FmdToVerify As List(Of Fmd) = New List(Of Fmd)
Private reset As Boolean = False
Private nThread As Thread
Private enrolledFmdStr As String
Public strsplit() As String
Public callsw As String
Public callsw1 As String
Public callOutputFileName As String
Private Function CaptureAndExtractFMD() As String
Dim capResult As CaptureResult
Dim vResult As IdentifyResult = Nothing
While Not reset
Dim result As Constants.ResultCode = _reader.GetStatus()
If _reader.Status.Status = Constants.ReaderStatuses.DP_STATUS_BUSY Then
Thread.Sleep(50)
Continue While
End If
If _reader.Status.Status = Constants.ReaderStatuses.DP_STATUS_READY Then
capResult = _reader.Capture(Constants.Formats.Fid.ANSI, Constants.CaptureProcessing.DP_IMG_PROC_DEFAULT, 5000, _reader.Capabilities.Resolutions(0))
If capResult.Quality = Constants.CaptureQuality.DP_QUALITY_GOOD Then
Dim count As Integer
Dim str As String
For count = 0 To 20
Try
str = strsplit(count).Trim(" ")
Catch ex As Exception
str = ""
End Try
If Not str = "" Then
Dim fs As FileStream = File.OpenRead(str)
Dim sr As StreamReader = New StreamReader(fs)
FmdToVerify.Clear()
FmdToVerify.Add(Fmd.DeserializeXml(sr.ReadLine().ToString()))
sr.Close()
Dim result3 As DataResult(Of Fmd) = FeatureExtraction.CreateFmdFromFid(capResult.Data, Constants.Formats.Fmd.DP_VERIFICATION)
If result3.ResultCode <> Constants.ResultCode.DP_SUCCESS Then
SendMessage("Could not successfully create Fmd")
Else
vResult = Comparison.Identify(result3.Data, 0, getFmdToVerify, 21474, 5)
If vResult.ResultCode = Constants.ResultCode.DP_SUCCESS Then
If vResult.Indexes.Length > 0 Then
SendMessage("User Authorized!")
callsw1 = str
callsw = "EXIT"
'btnMatchFound.Visible = True
Exit Function
Else
SendMessage("User Unauthorized!")
End If
Else
SendMessage("Error occured on verification")
End If
Dim FPBitmap As Bitmap = CreateBitmap(capResult.Data.Views(0).RawImage, capResult.Data.Views(0).Width, capResult.Data.Views(0).Height)
VerifyPictureBox.Image = New Bitmap(FPBitmap)
End If
End If
Next
End If
End If
End While
End Function
Visual COBOL on a TFS Build Controller
Hi,
We are planning to use TFS to build & deploy our COBOL programs. As I understand it we need to install Visual COBOL on the TFS Build Controller (that will be a separate server) and have a valid Visual COBOL license for that server. But do we also need to first install Visual Studio on the TFS Build Controller or is it enough with the build system installed as part of the TFS Build Controller?
Regards,
Ingela