+ Reply to Thread
Results 1 to 6 of 6

Thread: java call to cobol prg

  1. #1
    Guest.Visitor Guest

    Default java call to cobol prg

    calling cobol prg from java im making a projekt, where i want to make a call, to a program in cobol from java. i have read that this is not te smartest thing to do, because cobol is not thread safe. What does that mean ?. The way i want to do it, is to make the call in a thread, from a method that doesnt return until it gets the parameter back. What is the best way to call? (if it isnt a stupid idea) using ProgramCall , call it on Runtime exec or CommandCall

  2. #2
    Guest.Visitor Guest

    Default java call to cobol prg

    Hi John, There are entire books on threads and threading, but the basic concept is this: There are some languages and systems that support multithreading; java has this capability built in. I'm sure you're familiar with multitasking and preemptive time slicing on the 400. In a multithreaded program, it is as if subroutines within a single program could be preempted and another could run. If those routines access the same data, one subroutine could begin changing data, another routine could get control and change the same variables, then the first routine could regain control and be totally confused. There are specific methods of locking data to ensure that unexpected changes don't happen. When this is done, we call the routine ( process/method/etc ) "thread safe." Your call and wait should not be subject to any particular thread concerns UNLESS another thread in your java program tries to modify any variables used in the calling thread. The problem really is in the way java handles arguments ( parameters ) to non-java processes. The only really compatible way is to use the Java Native Interface ( JNI, ) which, take my word for it, you don't want to do if you can avoid it. The answer is to use some ipc mechanism such as data queues, message queues and so on to pass information around. If the cobol program is to be called frequently, or the java program using its services is run by many users, it may make sense to start up the cobol program ( or multiples ) prior to starting the java program, since I've suggested ipc mechanisms for communication. HTH, and NO, it wasn't a stupid idea. ;-) Best, Joe Sam Joe Sam Shirah Autumn Software Consulting/Development/Outsourcing Please Note New Email: jshirah@attglobal.net Visit our User Group at: http://www.jax400.com

  3. #3
    Guest.Visitor Guest

    Default java call to cobol prg

    What function(s) does the COBOL pgm perform?

  4. #4
    Guest.Visitor Guest

    Default java call to cobol prg

    my cobol doesent do anything yet, i plan to let it make a simpel request db2, and then returning a string. I havnt any purpos of doing it, my projekt is a scool projekt, and my teacher is an old cobol freak who doesnt know how to run java on as400, so it is very much self study projekt. but i think that the future for upcomming progrmmeres like myself, will be to make things work together. And my teacher is very interested in what im doing anyway thanks for a lot of good answers to a newbee.

  5. #5
    Guest.Visitor Guest

    Default java call to cobol prg

    Hi David. "Also I believe in V4R4 ILE COBOL and RPG can be threadsafe." Yes, but at quite a potential cost in performance. See: http://publib.boulder.ibm.com/pubs/h...HWILECO.HTM#HD RRZAHWILE-ILECO Joe Sam

  6. #6
    Guest.Visitor Guest

    Default java call to cobol prg

    The "AS/400 Toolbox for Java" provides a class named ProgramCall, that will call any AS/400 program (even a thread unsafe program) in its own separate process. Of course there are the usual concerns about if your program uses shared global resources on the AS/400; those concerns are not unique to the Java environment nor to multithreaded environments in general. For more details, see: http://publib.boulder.ibm.com/pubs/h...a/rzahh/toolbo x.htm and click on "Access classes" on the left. The Toolbox home page is at http://www.ibm.com/as400/toolbox - Jeff Lee, AS/400 Toolbox for Java team

+ Reply to Thread

Similar Threads

  1. Call a Java program from a COBOL program?
    By Guest.Visitor in forum Programming
    Replies: 3
    Last Post: 10-23-2000, 12:25 PM
  2. COBOL Call/Parm
    By Guest.Visitor in forum Programming
    Replies: 11
    Last Post: 02-19-1999, 07:11 AM
  3. Call Cobol/400 program from RPG/400
    By David Abramowitz in forum Programming
    Replies: 2
    Last Post: 11-30-1997, 11:21 PM
  4. Call a Java program from a COBOL program?
    By Guest.Visitor in forum Application Software
    Replies: 0
    Last Post: 01-01-1995, 02:00 AM
  5. Call a Java program from a Cobol Program?
    By Guest.Visitor in forum Programming
    Replies: 0
    Last Post: 01-01-1995, 02:00 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts