CREATE.FILE and path

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
adamski
Charter Member
Charter Member
Posts: 54
Joined: Thu Mar 20, 2003 5:02 pm

CREATE.FILE and path

Post by adamski »

Hi All

I am trying to use CREATE.FILE in a routine as per:

viewtopic.php?t=83463

However I can only create the file in the project directory.

I am wanting to do same in the directory of my choice, in which case the job aborts.

Any ideas?

Adamski
davidnemirovsky
Participant
Posts: 85
Joined: Fri Jun 04, 2004 2:30 am
Location: Melbourne, Australia
Contact:

Post by davidnemirovsky »

Hi Adamski,

Sounds like a security issue to me. Can you manually create a file in that directory using the same user account as the datastage job?
Cheers,
Dave Nemirovsky
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Adamski,

the CREATE.FILE syntax does not support the creation of remote files.

A Hash file in it's simplest form is defined by an entry in the VOC file that contains 3 lines - the first starting with "F" to denote a file type entry, the second the OS path to the DATA portion of the file and the third line the OS path to the DICTionary of that file.

The unix level utility to create a DataStage hashed file is mkdbfile, but I am not sure that the command line is documented so I won't go into that here.

I would suggest using CREATE.FILE to create a template empty file. In your routine, instead of creating the file, do an OS-LEVEL copy of the DICT and DATA portions of the file (if you choose a type 30 file then this would be a directory) to the required location. If you want to use the file in Basic code or don't want to specify the path in the DS hash file stage, then you would need to add a file pointer to the VOC. Something along the lines of

Code: Select all

WRITE "F":@FM:"/tmp/myfiles/NewHashFile":@FM:"/tmp/myfiles/D_NewHashFile" ON VocFilePtr, "NewHashFile" ELSE ....
. Please note that writing to your VOC and getting it wrong might destroy your datastage project account.
adamski
Charter Member
Charter Member
Posts: 54
Joined: Thu Mar 20, 2003 5:02 pm

Post by adamski »

ArndW

mkdbfile is what is actually used by DS when using a hashed file stage as apears in the log. Hence this is what I will use.

Thanks for the clarification on CREATE.FILE

Adamski
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Great - I really couldn't remember whether mkdbfile was put out there by Ascential and didn't want to suggest using something undocumented. (I guess old habits die hard)
chucksmith
Premium Member
Premium Member
Posts: 385
Joined: Wed Jun 16, 2004 12:43 pm
Location: Virginia, USA
Contact:

Post by chucksmith »

Or, you can use a server job to create and/or clear your hashed files. Try:

Code: Select all

XFR ---> HASH
where the constraint on the output link is @FALSE, and the transform stage has a stage variable. As you know, the hashed file stage will create hashed files in either the project or another directory. Therefore, you get the best of all worlds, a concise job design that conveys a great deal of information visually, protection from internal DataStage changes, and a design more familiar to those new to DataStage Basic.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Chuck's solution is by far the cleanest and leaves a much better status after the original coder is gone. Good suggestion!
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You can also use DDL. This has the side-effect of building the dictionary (as does Chuck's approach).

Code: Select all

CREATE TABLE tablename
   DATA pathname
   DICT pathname
(
   column_definition_1,
   column_definition_2,
   etc.
);
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply