dbTalk Databases Forums  

Compiling outside of UV

comp.databases.pick comp.databases.pick


Discuss Compiling outside of UV in the comp.databases.pick forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Rick Weiser
 
Posts: n/a

Default Compiling outside of UV - 08-10-2006 , 11:32 PM






A few months ago I posted a question on how to compile a UV Basic
program from outside of UV. Dave Mitchel was kind enough to supply the
following answer:

Quote:
It seems Rick is asking for a Windows script (or batch file, for us old DOS
fogies) to compile and catalog a basic program in UV. manufv's answer so
far seems the closest, but the UV command invoked directly from a DOS
command line doesn't seem to want to catalog.

So, here's my solution:

1) Write a BASIC program somewhere that accepts command line input using
@SENTENCE, and parse out fields 2 and 3 for filename and program name, then
simply execute two commands to compile and catalog. Compile and catalog
this program somewhere (I called my program DOS.COMP, and compiled and
cataloged it in an account I have called MIS).

2) Use this anytime from a DOS command line to compile and catalog any given
program, using

C:\whatever\uv\bin\UV DOS.COMP filename programname

in your batch file.

My DOS.COMP code:

TCL = @SENTENCE
FILENAME = FIELD(TCL," ",2)
PROGNAME = FIELD(TCL," ",3)
IF FILENAME = "" OR PROGNAME = "" THEN
GOSUB Usage
STOP
END
CMD1 = "BASIC ":FILENAME:" ":PROGNAME
CMD2 = "CATALOG ":FILENAME:" ":PROGNAME
EXECUTE CMD1
EXECUTE CMD2
STOP
*
Usage:
PRINT "USAGE: DOS.COMP Filename ProgramName"
RETURN

I wrote a simple "Hello World" program in the PGM file of the MIS account,
and called it MITCH. I didn't compile or catalog it, though. Then I ran:

C:\IBM\Accounts\MIS>..\..\uv\bin\UV DOS.COMP PGM MITCH

from a DOS command line. The output was:

Compiling: Source = 'PGM/MITCH', Object = 'PGM.O/MITCH'

Compilation Complete.
"MITCH" cataloged.

Going back into UV, into my MIS account, I simply type MITCH, and it says
Hello World, just as if I had comiled and cataloged it within UV.

Hope this helps

Mitch
This works fine but only if UV is on the localhost. I now have the
need to do this same thing but remotely. I am working on a PC that has
access to the UV host (all windows) and I want to compile and catalog
programs on the UV host remotely. I have been thinking about creating
a VBscript to do this but since I have never worked with UniObjects
before I am having difficulty. If anyone has any suggestions that of
course won't cost me anything, I would greatly appreciate it.

Thanks,

Rick



Reply With Quote
  #2  
Old   
Symeon
 
Posts: n/a

Default Re: Compiling outside of UV - 08-11-2006 , 05:44 AM






Off the top of my head .....


' VBScript File to connect to a u2 host via UO and compile a program
Option Explicit
Dim fil, prog, host, account, login, pass, u2type, Sess, Cmd, basicCmd,
catCmd, catOpts, output, CreateSession
host = "localhost"
account = "/home/symeon/ud"
login = "user"
pass = "pass"
u2type = "2" ' 1 = universe, 2 = unidata
catOpts = "FORCE" ' put your catalog options in here

If WScript.Arguments.Count <> 2 Then
Wscript.Echo "Usage: u2compile.vbs <fileName> <programName>"
WScript.Quit
End If

fil = WScript.Arguments(0)
prog = WScript.Arguments(1)
basicCmd = "BASIC " & fil & " " & prog
catCmd = "CATALOG " & fil & " " & prog & " " & catOpts

CreateSess
Sess.HostName = host
Sess.UserName = login
Sess.Password = pass
Sess.AccountPath = account
Sess.DatabaseType = u2type
Sess.Connect

If Sess.error > 0 Then
Msgbox "Connection failed " & Sess.Error
WScript.Quit
End If

Set Cmd = Sess.Command
Cmd.Text = basicCmd
Cmd.Exec
output = Cmd.Response
Cmd.Text = catCmd
Cmd.Exec
output = output & " " & Cmd.Response
Msgbox output
' end of script

Sub CreateSess()
CreateSession = True
Set Sess = CreateObject("UniObjects.UnioaifCtrl.1")
If (Err <> False) Or (Sess Is Nothing) Then
Err = False
Set Sess = CreateObject("uniobjects.session.1")
If (Err <> False) Or (UV Is Nothing) Then
Err = False
Set Sess = CreateObject("universe.session.1")
If (Err <> False) Or (UV Is Nothing) Then
CreateSession = False
End If
End If
End If
End Sub


Just change the account,login,password, u2type and catalog options
...... then on the command line type u2compile.vbs Filename Programname

PS - I am sure one of your coleagues in Oz would have done this for you
??

Rick Weiser wrote:
Quote:
A few months ago I posted a question on how to compile a UV Basic
program from outside of UV. Dave Mitchel was kind enough to supply the
following answer:

It seems Rick is asking for a Windows script (or batch file, for us old DOS
fogies) to compile and catalog a basic program in UV. manufv's answer so
far seems the closest, but the UV command invoked directly from a DOS
command line doesn't seem to want to catalog.

So, here's my solution:

1) Write a BASIC program somewhere that accepts command line input using
@SENTENCE, and parse out fields 2 and 3 for filename and program name, then
simply execute two commands to compile and catalog. Compile and catalog
this program somewhere (I called my program DOS.COMP, and compiled and
cataloged it in an account I have called MIS).

2) Use this anytime from a DOS command line to compile and catalog any given
program, using

C:\whatever\uv\bin\UV DOS.COMP filename programname

in your batch file.

My DOS.COMP code:

TCL = @SENTENCE
FILENAME = FIELD(TCL," ",2)
PROGNAME = FIELD(TCL," ",3)
IF FILENAME = "" OR PROGNAME = "" THEN
GOSUB Usage
STOP
END
CMD1 = "BASIC ":FILENAME:" ":PROGNAME
CMD2 = "CATALOG ":FILENAME:" ":PROGNAME
EXECUTE CMD1
EXECUTE CMD2
STOP
*
Usage:
PRINT "USAGE: DOS.COMP Filename ProgramName"
RETURN

I wrote a simple "Hello World" program in the PGM file of the MIS account,
and called it MITCH. I didn't compile or catalog it, though. Then I ran:

C:\IBM\Accounts\MIS>..\..\uv\bin\UV DOS.COMP PGM MITCH

from a DOS command line. The output was:

Compiling: Source = 'PGM/MITCH', Object = 'PGM.O/MITCH'

Compilation Complete.
"MITCH" cataloged.

Going back into UV, into my MIS account, I simply type MITCH, and it says
Hello World, just as if I had comiled and cataloged it within UV.

Hope this helps

Mitch

This works fine but only if UV is on the localhost. I now have the
need to do this same thing but remotely. I am working on a PC that has
access to the UV host (all windows) and I want to compile and catalog
programs on the UV host remotely. I have been thinking about creating
a VBscript to do this but since I have never worked with UniObjects
before I am having difficulty. If anyone has any suggestions that of
course won't cost me anything, I would greatly appreciate it.

Thanks,

Rick


Reply With Quote
  #3  
Old   
Tony Gravagno
 
Posts: n/a

Default Re: Compiling outside of UV - 08-13-2006 , 02:57 AM



MVExec - free code, one mv.NET license, and everything works the way
you wanted locally or remotely. I wish we could tally up the dollar
value for time spent in the quest for free solutions.
http:// removethisNebula-RnD.com/freeware/
See MVExec_README.rtf for usage details and a specific example that
compiles code on a remote server.

T

"Rick Weiser" wrote:

Quote:
A few months ago I posted a question on how to compile a UV Basic
program from outside of UV. Dave Mitchel was kind enough to supply the
following answer:
[snip]
This works fine but only if UV is on the localhost. I now have the
need to do this same thing but remotely. I am working on a PC that has
access to the UV host (all windows) and I want to compile and catalog
programs on the UV host remotely. I have been thinking about creating
a VBscript to do this but since I have never worked with UniObjects
before I am having difficulty. If anyone has any suggestions that of
course won't cost me anything, I would greatly appreciate it.

Thanks,

Rick


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.