Can a DataStage Basic Program be run from Unix shell

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
memrinal
Participant
Posts: 74
Joined: Wed Nov 24, 2004 9:13 pm

Can a DataStage Basic Program be run from Unix shell

Post 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
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post 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.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post 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.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
WoMaWil
Participant
Posts: 482
Joined: Thu Mar 13, 2003 7:17 am
Location: Amsterdam

Post 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.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
memrinal
Participant
Posts: 74
Joined: Wed Nov 24, 2004 9:13 pm

just wanted to run a BASIC program from shell prompt

Post 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.
memrinal
Participant
Posts: 74
Joined: Wed Nov 24, 2004 9:13 pm

How do i create a type 19 file

Post 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.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
memrinal
Participant
Posts: 74
Joined: Wed Nov 24, 2004 9:13 pm

Post 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
Mrinal Kumar

Even the IMPOSSIBLE says "I M Possible"
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
memrinal
Participant
Posts: 74
Joined: Wed Nov 24, 2004 9:13 pm

Post by memrinal »

Thanks a lot for your help . i was just curious how to do it. anyway thanks a lot.
Mrinal Kumar

Even the IMPOSSIBLE says "I M Possible"
Post Reply