Page 1 of 1

Can a DataStage Basic Program be run from Unix shell

Posted: Mon Dec 20, 2004 6:20 am
by memrinal
I was going through DataStage Documnetation and it says that DataStage BASIC Programs can be made to run from the UNIX shell prompt. Can anyone tell me how to do that. i tried with BASIC command but the shell didn't recognize the command and gave
'ksh: BASIC: not found'

message.
Please let me know what should be done to make the program. should the path be set?
Also can i execute the same program from Windows environment where my DataStage Client is located.
Regards
Mrinal

Posted: Mon Dec 20, 2004 8:27 am
by kcbland
All jobs or programs execute on the server side, your client is irrelevant. To create a DS BASIC program, you're going to have to learn how to develop DS BASIC programs. I suggest you head over to IBMs website and download the Universe manuals, as DS BASIC is a derivative of Universe. You'll have to learn about using the BASIC compiler, creating a hash file to house your source code, and using the built-in editor (ED). Then, you'll get to learn about CATALOG and RUN and all kinds of stuff.

Posted: Mon Dec 20, 2004 8:29 am
by kcbland
Oh, and to run a program from the command line you have execute using the uvsh or dssh program. Something like "dssh YourCatalogedProgram" from the directory of the project in which it is compiled and cataloged.

Posted: Mon Dec 20, 2004 9:54 am
by WoMaWil
And if you like the easy way, you can write any basic programm in the codepart of any job. And a job can be executed via dsjob from any UNIX prompt.

Posted: Mon Dec 20, 2004 3:07 pm
by ray.wurlod
DataStage BASIC source can not be compiled if stored in a hashed file. You need to create a directory (in UniVerse-speak a "Type 19 file") for source code. Certainly you can store it in a hashed file, but you have to copy it into the Type 19 file to compile it. That's what the DSU_BP file is used for, for DataStage routines, which are actually stored in DS_ROUTINES (a hashed file).

The burning question in my mind, however, is what kind of "program" you are considering. If it's a DataStage job (which is a number of routines), the easier way is to use the dsjob command line interface.

What do you envisage doing?

just wanted to run a BASIC program from shell prompt

Posted: Mon Dec 20, 2004 10:40 pm
by memrinal
I have been calling BASIC routines from my jobs and have written several of them. While going through the documentation of DATASTAGE BASIC i read that programs can be compiled and run from the shell prompt. but then it spoke about storing the file as a record of type 19 and some stuff i could not understand.
Say i want to write a BASIC program to open two files and concatenate them.
what are the steps involved.
with what extension i save the file.
how do i compile the file and how do i run it.

i know its very easy from jobs, but i want to do this thing at shell prompt only. according to documentation this thing should be possible.
Regards
Mrinal.

How do i create a type 19 file

Posted: Mon Dec 20, 2004 11:34 pm
by memrinal
The Universe BASIC Documentation says CREATE.FILE can be used to create a type 19 File. But the same gives
ksh: CREATE.FILE: not found
How do i create a type 19 file.
Please help.

Posted: Tue Dec 21, 2004 12:34 am
by ray.wurlod
Everything in the UniVerse BASIC and DataStage BASIC manuals assumes that you are interactively in the shell (uvsh or dssh respectively).
To achieve this in DataStage you must be attached to a project directory, have executed the dsenv script (on UNIX only), and have issued the dssh command ($DSHOME/bin/dssh).
Only then will commands like CREATE.FILE work.

(You can do it all from the DataStage Administrator client Command window, too. But editing programs through this mechanism will be a pain.)

It will never be possible to run routines. Routines have argument lists, and therefore can not be run in stand-alone mode. The only thing you can run is a PROGRAM. These are not inherently used within DataStage.

What ARE you trying to accomplish?

Posted: Tue Dec 21, 2004 1:44 am
by memrinal
I just want to compile and run a BASIC program from The Unix Shell Prompt. Can you please tell the steps in which i should go about it

Posted: Tue Dec 21, 2004 2:50 am
by ray.wurlod
Provided it's a PROGRAM (and not a FUNCTION or a SUBROUTINE), the following steps are required.

Get to the UNIX prompt.

Ensure that your $DSHOME environment variable is set to the correct value (the location of the DSEngine directory).

Execute the $DSHOME/dsenv shell script.

Change directory to the DataStage project in which you have created the program.

Assuming that you have created a Type 19 file called BASIC.PROGS and created a program called MYPROG within it you can compile the program with the command:

Code: Select all

$DSHOME/bin/dssh "BASIC BASIC.PROGS MYPROG"
Catalog the program using the command:

Code: Select all

$DSHOME/bin/dssh "CATALOG BASIC.PROGS MYPROG LOCAL"
Execute the program (which cataloging has converted into a DataStage command) using the command:

Code: Select all

$DSHOME/bin/dssh "MYPROG"
Another way to execute the program is:

Code: Select all

$DSHOME/bin/dssh "RUN BASIC.PROGS MYPROG"
You should really have no reason to do any of this. I provide the steps since you seem so insistent. Please do not try to re-invent any of the programs already part of DataStage; it is a waste of your and your employer's time.

The answer for FUNCTIONs and SUBROUTINEs I gave earlier; they can not be run from the command prompt, either the UNIX command prompt or the dssh command prompt.

There are several options on each of these commands, which you can discover in the DataStage BASIC manual.

Finally let me reiterate that this is NOT something you really want to do.

I now consider this topic closed, and will not respond to it again.

Posted: Tue Dec 21, 2004 3:24 am
by memrinal
Thanks a lot for your help . i was just curious how to do it. anyway thanks a lot.