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
308 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
6 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

790 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