Quantcast
Channel: Visual COBOL - Forum - Recent Threads
Viewing all 4356 articles
Browse latest View live

use a c sharp class in visual cobol

$
0
0

I have a main c# application that runs visual cobol programs. both project have different namespaces. In my c sharp project I have a logger class that I would like both projects to use.

So far I've made a reference to the main project from the cobol project, used $set ilusing"namespace" added the namespace to the cobol project through the GUI. Nothing. I think I might be missing a bigger issue. Any ideas?


RE: use a c sharp class in visual cobol

$
0
0

I think the problem may be that you are adding a reference to a main project (.exe) and not to a class library (.dll). An .exe cannot be loaded.

If you need to reference the logger class from both the C# main and the called COBOL Class library you should probably place the common logger class into a project by itself and then reference this from both C# and the COBOL projects.

RE: Creating reports? - got any good ideas?

RE: Creating reports? - got any good ideas?

Creating reports? - got any good ideas?

$
0
0

Hi all,

How to simplify the user experience re. generating, viewing and printing reports in a Windows environment?

Currently I display report output in an MF Dialog system window and have a [print] button to print using various MF COBOL routines, PC_PRINTER_SET_DEFAULT, PC_PRINTER_SET_FONT etc. The reports are basic using fixed-spaced characters to force column alignment. They look old-fashioned and text is small.

HOW DO YOU PRINT from Visual COBOL?

I'm wondering about launching a browser to handle the print so users can re-size, use browser's print / pdf-export etc. Any thoughts?

I'm about to switch to MYSQL - perhaps you'd recommend tools that can report from MYSQL directly?

ANY THOUGHTS WELCOME.

Regards, Linden

RE: Creating reports? - got any good ideas?

$
0
0

We here use Crystal Reports for Visual Studio, serves us very well!

RE: Creating reports? - got any good ideas?

$
0
0

Thanks WPita_MMSIS, useful to hear what people are using. Regards, Linden

Quick scan of IDXFORMAT "8" files

$
0
0

I am running on Redhat and years ago when I had my data files with the index info split out I could do a "grep" of the data portion. Now when I try to quickly scan for something I get "Binary file X.LDF matches"

Any suggestions?  I know I can use ODBC connectors and I do, but just looking for a quick utility like I used to have.

Thanks for any suggestions.


RE: use a c sharp class in visual cobol

dynamically loading a winform based on a string

$
0
0

The issue.

I have a c# application that does the following: reads an xml file with menu tree items, gets the user and groups from AD then using that information builds the menu tree. Each of the menu tree leaves are visual cobol programs that the user can run.

Currently I have a switch statement looking at the name of the node and opening the appropriate winform (visual cobol). I would like to use reflection by having the visual cobol class name in the xml file. That way when I add a new program, I can update the xml file and upload the cobol program without needing to recompile the c sharp application.

I've tried using:

Activator.CreateInstance which gives me a "could not load type ***** from assembly *******"

 Assembly.GetExecutingAssembly().CreateInstance which throws "object reference not set to as instance of an object"

Any one have any thoughts? I have not issue just writing a large switch and recompiling whenever a new program is added.

RE: Quick scan of IDXFORMAT "8" files

$
0
0

strings -a filename | grep pattern

There's also the --text option to (GNU) grep, which forces it to treat the file as text, but that's likely to spew a bunch of control characters to the terminal, since the file is not, in fact, text. Using strings is a better bet.

RE: Quick scan of IDXFORMAT "8" files

$
0
0

I should note I'm assuming here the text data in your file is ASCII or UTF-8. If it's some other character encoding, "strings" won't recognize it. (Though it's possible GNU strings has support for other encodings; I haven't checked.)

Using Arrow Keys

$
0
0

I am trying to capture the use of the arrow keys in my code and it is not being recognized. It seems as if the keys are reserved for the form itself and when I press the arrow keys they just move from one button to the next similar to using the Tab key to maneuver through the various buttons. This code will trap the key down event for the other keys but not the arrow or tab keys.

 

method-idfrm1CALENDAR_KeyDownfinalprivate.

proceduredivisionusingbyvaluesenderasobjecteastypeSystem.Windows.Forms.KeyEventArgs.

* Immediately return if not a valid action key

IFe::KeyCode = typeKeys::PageUp

ORe::KeyCode = typeKeys::PageDown

ORe::KeyCode = typeKeys::Enter

ORe::KeyCode = typeKeys::Up

ORe::KeyCode = typeKeys::Down

ORe::KeyCode = typeKeys::Left

ORe::KeyCode = typeKeys::Right

ORe::KeyCode = typeKeys::Escape

continue

else

goback.

ife::KeyCode = typeKeys::Up

invokeself::btnUp::PerformClick()

goback

end-if.

ife::KeyCode = typeKeys::Down

invokeself::btnDown::PerformClick()

goback

end-if.

ife::KeyCode = typeKeys::Right

invokeself::btnRight::PerformClick()

goback

end-if.

ife::KeyCode = typeKeys::Left

invokeself::btnLeft::PerformClick()

goback

end-if.

ife::KeyCode = typeKeys::PageUp

invokeself::btnPgUp::PerformClick()

goback

end-if.

ife::KeyCode = typeKeys::PageDown

invokeself::btnPgDn::PerformClick()

goback

end-if.

ife::KeyCode = typeKeys::Enter

invokeself::btnSelect::PerformClick()

goback

end-if.

ife::KeyCode = typeKeys::Escape

invokeself::btnExit::PerformClick()

goback

end-if.

endmethod.

RE: inherits from superclasse with data.

$
0
0
Hi, Chris.
 
I am using Net Express 3.1.
 
I will send you a basic test (can I attach a file?).
I discovered that if I define a FD in the Super Class or in the class that inherits it, this does not work.
Thanks.
 
 
SUPERCLASSE

      *******************************************************************

       Class-id. superclasse

                 inherits from base.

      *-------------------------------

       Object                 Section.

      *-------------------------------

       Class-Control.

      *--------------

           superclasse is class "superclasse"

           base is class "base"

           .

      *-------------------------------

       Working-Storage        Section. *> Definition of global data

      *-------------------------------

       01           GlobalData          pic x(032).

      */////////////////////////////////////////////////////////////////*

      *             Definition of class data and methods                *

      */////////////////////////////////////////////////////////////////*

       Class-Object.

      *-------------

      *-------------------------------

       Object-Storage         Section.

      *-------------------------------

       01           ClassData           pic x(032).

      *//////////////////////////////////////////////////////////////////

      *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*

      *                                                                 *

      *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*

       Method-id. "CriarObjeto".

      *-------------------------------

       Linkage                Section.

      *-------------------------------

       01           lnkObjeto           Object Reference.

      *-----------------------------------------------------------------*

       Procedure              Division  Returning lnkObjeto.

      *-----------------------------------------------------------------*

           Invoke   SUPER "New"         Returning lnkObjeto

 

 

           Move     'Por SuperClasse em "CriarObjeto"' to ClassData

 

 

           Invoke   lnkObjeto "setGlobalData" Using ClassData

 

           Exit     Method

           .

       End Method "CriarObjeto".

      *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*

      *                                                                 *

      *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*

       Method-id. "setClassData".

      *-------------------------------

       Linkage                Section.

      *-------------------------------

       01           lnkClassData        pic x(32).

      *******************************************************************

       Procedure              Division  Using lnkClassData.

      *******************************************************************

           Move     lnkClassData        to ClassData

 

           Exit     Method

           .

       End method "setClassData".

      *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*

      *                                                                 *

      *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*

       Method-id. "getClassData".

      *-------------------------------

       Linkage                Section.

      *-------------------------------

       01           lnkClassData        pic x(32).

      *-----------------------------------------------------------------*

       Procedure division returning lnkClassData.

           Move     ClassData           to lnkClassData

           Move     'Modificado por superclasse' to ClassData

 

           Exit     Method

           .

       End method "getClassData".

      *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*

       End class-object.

      */////////////////////////////////////////////////////////////////*

      *             Definition of instance data and methods             *

      */////////////////////////////////////////////////////////////////*

       Object.

      *-------------------------------

       Object-Storage         Section.

      *-------------------------------

       01           InstanceData        pic x(032).

       01           oVARIAVEIS.

         05         oFILEID1             PIC X(065) VALUE SPACES.

         05         oFileStatus1.

           10       oStatusKey11         PIC X.

           10       oStatusKey21         PIC X.

           10       oBinaryStatus1       REDEFINES oStatuskey21

                                        PIC 99 COMP-X.

      *//////////////////////////////////////////////////////////////////

      *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*

      *                                                                 *

      *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*

       Method-id. "setGlobalData".

      *-------------------------------

       Linkage                Section.

      *-------------------------------

       01 lnkGlobalData          pic x(32).

       Procedure division using lnkGlobalData.

           Move     lnkGlobalData       to GlobalData

           Move     'ajSauro'           to InstanceData

 

           Exit     Method

           .

       End method "setGlobalData".

      *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*

      *                                                                 *

      *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*

       Method-id. "getGlobalData".

      *-------------------------------

       Linkage                Section.

      *-------------------------------

       01           lnkGlobalData       pic x(32).

 

       Procedure division returning lnkGlobalData.

           Move     GlobalData          to lnkGlobalData

 

           Exit     Method

           .

       End method "getGlobalData".

      *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*

      *                                                                 *

      *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*

       Method-id. "getSuperInstanceData".

      *-------------------------------

       Linkage                Section.

      *-------------------------------

       01 lnkInstanceData        pic x(32).

 

       Procedure division returning lnkInstanceData.

           Move     InstanceData        to lnkInstanceData

 

           Exit     Method

           .

       End method "getSuperInstanceData".

      *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*

      *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*

       End object.

      *//////////////////////////////////////////////////////////////////

       End class SuperClasse.

      *******************************************************************

 
 

Class that inherits SuperClasse

      *******************************************************************

       class-id. ClasseWithData data is protected

                 inherits from superclasse with data.

      *-------------------------------

       Object                 Section.

      *-------------------------------

       Class-Control.

      *--------------

           ClasseWithData is class "ClasseWithData"

           superclasse is class "superclasse"

           .

      *-------------------------------

       Working-Storage        Section. *> Definition of global data

      *-------------------------------

      */////////////////////////////////////////////////////////////////*

      *             Definition of class data and methods                *

      */////////////////////////////////////////////////////////////////*

       Class-Object.

      *-------------

      *-------------------------------

       Object-Storage         Section.

      *-------------------------------

      *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*

      *                                                                 *

      *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*

       Method-id. "CriarObjeto".

      *-------------------------------

       Local-Storage          Section.

      *-------------------------------

       01           lsData              pic x(032).

      *-------------------------------

       Linkage                Section.

      *-------------------------------

       01           lnkObjeto           Object Reference.

      *-----------------------------------------------------------------*

       Procedure              Division  Returning lnkObjeto.

      *-----------------------------------------------------------------*

           Invoke   SUPER "CriarObjeto" Returning lnkObjeto

           Invoke   lnkObjeto "setInstanceData"

 

 

           Move     'Por ClasseWD em "CriarObjeto"' to ClassData

 

           Exit     Method

           .

       End Method "CriarObjeto".

      *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*

      *                                                                 *

      *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*

       Method-id. "getClassData".

      *-------------------------------

       Linkage                Section.

      *-------------------------------

       01           lnkClassData        pic x(32).

      *-----------------------------------------------------------------*

       Procedure division Returning lnkClassData.

           Invoke   SUPER "getClassData" Returning lnkClassData

 

           Exit     Method

           .

       End method "getClassData".

      *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*

      *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*

       End class-object.

      */////////////////////////////////////////////////////////////////*

      *             Definition of instance data and methods             *

      */////////////////////////////////////////////////////////////////*

       Object.

      *------------------------------

      *Input-Output           Section.

      *------------------------------

      *File-Control.

      *------------

      *    SELECT   arqSYSCONF    ASSIGN TO DISK

      *             ORGANIZATION IS     LINE SEQUENTIAL

      *             FILE STATUS  IS     oFileStatus1

      *             ACCESS MODE  IS     SEQUENTIAL.

      *******************************************************************

      *Data                   Division.

      *******************************************************************

      *------------------------------

      *File                   Section.

      *------------------------------

      *FD           arqSYSCONF

      *             LABEL RECORD        IS STANDARD

      *             RECORD CONTAINS     013 CHARACTERS

      *             VALUE OF FILE-ID    IS oFILEID1.

      *

      *01           scREG.

      *  05         scCHAVE.

      *    10       FILLER              PIC X(005).

      *  05         scDADOS.

      *    10       FILLER              PIC X(008).

      *//////////////////////////////////////////////////////////////////

      *-------------------------------

       Object-Storage         Section.

      *-------------------------------

       77           umaWindow           object reference value null.

      *//////////////////////////////////////////////////////////////////

       01           wOpenStatus         PIC X(006) VALUE SPACES.

       01           aString             object reference.

      *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*

      *                                                                 *

      *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*

       Method-id. "setInstanceData".

      *-------------------------------

       Linkage                Section.

      *-------------------------------

       01           lnkInstanceData     pic x(32).

       Procedure division using lnkInstanceData.

           If       Address lnkInstanceData is equal null

           Move '"setInstanceData" em ClasseWithData' to InstanceData *>Definida em SUPERCLASSE

           Else

                    Move lnkInstanceData to InstanceData *>Definida em SUPERCLASSE

           End-If

 

           Exit     Method

           .

       End method "setInstanceData".

      *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*

      *                                                                 *

      *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*

       Method-id. "getInstanceData".

      *-------------------------------

       Linkage                Section.

      *-------------------------------

       01           lnkInstanceData     pic x(32).

       Procedure              Division  Returning lnkInstanceData.

                 *> Definida em SUPERCLASSE

           Move     InstanceData        to lnkInstanceData

 

           Exit     Method

           .

       End method "getInstanceData".

      *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*

      *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*

       End object.

      *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*

       end class ClasseWithData.

      *******************************************************************

OpenESQL issues

$
0
0

Hi,

I'm getting odd behaviour testing OpenESQL (VC2.3.2, VS2015, Windows10). I've previously only used native MF files but have used MySQL extensively with PHP online.

My tests act as though MF DEBUG runs in it's own world. It doesn't actually update my MySQL database?

I have a 3-col 'vatrates' table. Cols: id, startDate and vatRate. It has one row of data.

My prog below inserts two more rows. No error is reported, Hence 3 rows.

Next I run select/fetch - this gets the three rows, the old row and two new ones.

Lastly the prog deletes a row - this seems to work and if I re-step through the select/fetch it returns two rows.

HOWEVER, at any point during the above and after stop run... if i view the table in MySQL Workbench I only see the original row. If I re-run my prog it starts again as though only the original one row is there.

Any ideas what is going on here? Program follows below....

Thanks, Linden

----------------------------

$SET sql(INIT DB=adbooker PASS=adbooker.pw)
working-storage section.
exec sql include sqlca end-exec.
01 mfsqlmessagetext pic x(1000).
01 sql-statement pic x(1000).

01 startDate pic x(8).
01 vatRate pic 99v99.
01 vatId pic 9(9).
procedure division.

  exec sql
    whenever sqlerror perform show-error
  end-exec.

  exec sql
    insert into vatrates
        (startDate, vatrate)
    values
        ('2009-08-18', 13.17)
  end-exec.

  move "insert into vatrates (startDate, vatRate)"
        & " values ('2008-01-02', 88.77)" to sql-statement.
  exec sql execute immediate :sql-statement end-exec.

  move "select id, DATE_FORMAT(startDate,'%Y%m%d'), vatRate"
        & " from vatrates order by startDate desc"
      to sql-statement.
  exec sql prepare mysql from :sql-statement end-exec.
  exec sql declare mycursor cursor for mysql end-exec.
  exec sql open mycursor end-exec.
AGAIN.
  exec sql fetch mycursor
        into :vatId, :startDate, :vatRate
  end-exec.
  if sqlcode = zero
     go to AGAIN.

  exec sql close mycursor end-exec.

  move "delete from vatrates where id = ?" to sql-statement.
  exec sql prepare mysql from :sql-statement end-exec.
  exec sql execute mysql using :vatId end-exec.

  STOP RUN.

  

 

 

  


RE: OpenESQL issues

$
0
0

You are not committing your changes to the database. You need to issue a

EXEC SQL COMMIT WORK END-EXEC

statement in order to make them permanent.

RE: inherits from superclasse with data.

$
0
0

You can attach a file by clicking on the Use rich formatting link below and then clicking on the Options tab at the top. File size is limited to 64KB though I believe.

What is the actual error that you are getting? Stating that it doesn't work is not much for me to go on and NX 3.1 is an extremely old product.

Thanks.

RE: OpenESQL issues

$
0
0

ah ok thanks Chris. The default is to rollback then.

ALSO... would you suggest using explicit connect rather than the implicit set statement?

RE: OpenESQL issues

$
0
0

You could turn on the directive SQL(autocommit) so that it will perform a commit after each statement.

I prefer using an explicit connect statement in my program so that I can have more control over the connect and error handling. Also if you ever need to disconnect or use more than one connection you would have to do this explicitly. It is really personal preference though.

RE: OpenESQL issues

$
0
0

Thanks Chris, I'll have to have a think / look into all that. I need to do transaction rollback anyway in the live system. Generally though i-o is so reliable and with low numbers of users I haven't worried about it unduly. Thanks again. Linden

Viewing all 4356 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>