Create Dynamic files

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
bkumar103
Participant
Posts: 214
Joined: Wed Jul 25, 2007 2:29 am
Location: Chennai

Create Dynamic files

Post by bkumar103 »

Is it possible to create files dynamically based on the some input column value. For example

suppose the the input consist of two columns country_cd and city_cd.
and the input stores the information abt 5 distinct country and their respective city as follow

Country_cd city_cd
===========================
cntry1 city1
cntry1 city2
cntry2 city2
cntry2 city3
cntry3 city4
cntry4 city5
cntry5 city5

what i require here is one seperate file should be created for each county and respective country records should go to the corresponding file.
like the file cntry1.txt should have folllowing records:

Country_cd city_cd
===========================
cntry1 city1
cntry1 city2

Pease let me know if this is possible to do in parallel jobs.
Birendra
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Yes, you can do this. DataStage hashed files have various types, and a type 19 file is stored as directory. Each "Key" in this hashed file is stored as an OS file, and each hashed file record contents is stored as a row in that file.
In your case the key (and file name) would be the "Country_cd". You would need to read the old "Country_cd" record and then append the new city to the string, and this function is not going to be particularly fast, but it will work.
bkumar103
Participant
Posts: 214
Joined: Wed Jul 25, 2007 2:29 am
Location: Chennai

Post by bkumar103 »

But Hashed file are not available as part of parallel job. Is there any work around in PX?
Birendra
throbinson
Charter Member
Charter Member
Posts: 299
Joined: Wed Nov 13, 2002 5:38 pm
Location: USA

Post by throbinson »

None that I know of but would love to be proved wrong. You posted in the Server forum and so the reply you got was Server-centric. Help a brother out and post in the right forum and you'll probably get a more appropriate answer.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

If it is a parallel job, please post it there, not in the server forum.

Moderator - Please move this post to the PX Forum
bkumar103
Participant
Posts: 214
Joined: Wed Jul 25, 2007 2:29 am
Location: Chennai

Post by bkumar103 »

Sorry for i have posted in the wrong forum.

Arndw wrote:
Yes, you can do this. DataStage hashed files have various types, and a type 19 file is stored as directory. Each "Key" in this hashed file is stored as an OS file, and each hashed
But i am unable to file the type 19 hashed file. What i find is type 2 to type 18 and then type 25 and type 30.
Birendra
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

I am not sure where you are looking, but type 1 and 19 files exist; both are directory types but type 1 has a limited filename/key length and shouldn't be used.
bkumar103
Participant
Posts: 214
Joined: Wed Jul 25, 2007 2:29 am
Location: Chennai

Post by bkumar103 »

Please correct me if i am looking at the wrong place.
The job is simple
Sequential file -------------------> Hashed file

In the hashed file properties
In the INPUT ---> General tab
I checked "Create file" then clicked the Option button where i just find type 2 to type 18 and type 25 and type 30.

Is it the correct location or i am missing something.

I am using 7.5.2 on HP-UX.

What could be the key from the given example. Because country is repetitive in the example.
Birendra
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

It doesn't allow you to create these two file types in the hashed file stage. The forum contains numerous descriptions of how you can create your own files, i.e. "CREATE.FILE MYFILE 10" from the TCL command line.

In this example the key would be COUNTRY.
nivas
Participant
Posts: 117
Joined: Sun Mar 21, 2004 4:40 pm

Post by nivas »

Use OpenSeq, Create and WriteSeq
Post Reply