Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Does anyone know how to kick-off a Cobol program residing on a Unix box from a Windows App written in VB or VB.NET?

Posted on 2003-12-10
6
Medium Priority
?
318 Views
Last Modified: 2008-01-09
I need to kick off a file-based Lawson ERP interface program on a Unix server from a microsoft VB/COM or .NET client.  

My client has a pre-determined file layout for a specific type of  inventory transaction.  After I create a file in my VB program for this transaction and FTP it to a specified directory on the Unix box, I need to kick off a COBOL program on the Unix box.  The COBOL program will pick up my file, read it, apply numerous business rules, calculations, and database updates.

How do I remotely kick-off a Unix program from a windows environment?



0
Comment
Question by:vjcapron
4 Comments
 
LVL 9

Expert Comment

by:Dang123
ID: 9920034
vjcapron,
    Here are some ideas.

1) http://www.vb-helper.com/tutorial_screen_scraping.html
    Use this method to go through the motions of logging on with the necessary id and submitting the program.

2) Create a job on the Unix box that runs continuously. It should look for a file with a specific name placed in a specific directory. If it finds the file, it should open it and execute the commands inside (logging the action), then delete the file and start looking for it again. You VB program then needs to simply upload the instruction file as a fine step.

3) MVS has the following FTP commands to submit jobs into the execution queue
        literal site file=jes
        put job.jcl
Check local help or the documentation for your Unix FTP to see if something similar exists for you.

Hope one of the ideas helps

Dang123

0
 
LVL 1

Expert Comment

by:RichNH
ID: 9927916
I'm not familiar with UNIX but I agree that the most probable solution is one where the unix box has a process running continously (usually some sort of batch/script job that has a wait statement in it or is on a scheduler and runs every few minutes).  The batch job would check for the presence of the file and if found would start the COBOL job.  If one cannot check for a file's existance in script in Unix (I would think that you could) then it's easy enough to simply code the COBOL program to check if the file is present or not when you try to open it (look at the status return code for the open) and if its not present then end the program.  Obviously if it is present you process the file.

RichNH
0
 

Author Comment

by:vjcapron
ID: 9949809
The most appropriate answer to the question "How do I remotely kick-off a Unix program from a windows environment?" is executing a remote shell command from a .NET application.

The .NET framework provides an object for this purpose, which makes it a very clean solution.  Below is a code snippet:

Const RSH_Host As String = "10.2.2.1"  'NameOfUnixBox_Or_IPAddress
Const RSH_Path As String = "/users/law/prod/drsrc/net.sh"  'path to program
Const RSH_User As String = "UserName"  'UserID with appropriate permissions
Const RSH_PW As String = "Password"  

Dim RunRSH As New WinRSH32Runner.Execute()
RunRSH.Go(RSH_Host, RSH_Path, RSH_User, RSH_PW, False)
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 10971710
PAQed, with points refunded (250)

modulo
Community Support Moderator
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
If you are a mobile app developer and especially develop hybrid mobile apps then these 4 mistakes you must avoid for hybrid app development to be the more genuine app developer.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Introduction to Processes

824 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question