Address nameless columns in Hashed 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
mavrick21
Premium Member
Premium Member
Posts: 335
Joined: Sun Apr 23, 2006 11:25 pm

Address nameless columns in Hashed files

Post by mavrick21 »

Hello Gurus,

There's a hashed file which has two columns - Col1 and Col2. Col1 contains vachar data and is a key. Col2 is a timestamp field. I need to update Col2 data to '1700-01-01 00:00:00'.

When I do LIST.DICT here is what I get

Code: Select all


               Type &
Field......... Field. Field........ Conversion.. Column......... Output Depth &
Name.......... Number Definition... Code........ Heading........ Format Assoc..

@ID            D    0                            SDKMaxLastUpdDt 10L    S
                                                 tm_E

1 records listed.

My try with the following code was unsuccessful:
UPDATE <hashed file> SET Col2 = '1700-01-01 00:00:00'

Got error like - Invalid token at Col2.

How do I address columns in a Hashed file which has no names?

Thanks
-Mav
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

If you want to use SQL to insert or update, you will need to provide column names in the file dictionary. Search DSXchange for "INSERT INTO DICT" for examples.

Otherwise you can use DataStage BASIC code (which does not need column names) or an operating system command such as UVwrite.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Or just build a mapping... err, job... to do that. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
zulfi123786
Premium Member
Premium Member
Posts: 730
Joined: Tue Nov 04, 2008 10:14 am
Location: Bangalore

Post by zulfi123786 »

ray.wurlod wrote:Otherwise you can use DataStage BASIC code (which does not need column names) or an operating system command such as UVwrite.
Was wondering how would an update work without providing the column name, how does it reference what has to be updated?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Hashed files columns are referenced positionally, not by name. Ever wondered why the 'column names' you use in the stage don't really matter? That's why and I assume part of the answer.
-craig

"You can never have too many knives" -- Logan Nine Fingers
zulfi123786
Premium Member
Premium Member
Posts: 730
Joined: Tue Nov 04, 2008 10:14 am
Location: Bangalore

Post by zulfi123786 »

When we try to update a column in a Hashed file, there should be an identifier that holds the position, right?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Not necessarily. Depends how the hashed file was created in the first place and whether the metadata were available at that time.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
suresh.angadi
Participant
Posts: 17
Joined: Tue Jun 23, 2009 6:44 pm

Re: Address nameless columns in Hashed files

Post by suresh.angadi »

Hi,

delete the hash file with delete.file <File Name> then recreate and populate the data and then try to update the hash file.

Regards
Suresh
Suresh Angadi
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

That does not address the issue, which is the lack of metadata in the hashed file's file dictionary.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
zulfi123786
Premium Member
Premium Member
Posts: 730
Joined: Tue Nov 04, 2008 10:14 am
Location: Bangalore

Post by zulfi123786 »

say the hashfile was created with a path and no VOC entry and i need to update the hashfile (xyz.hs) for the key column value=100 to set a column no 3 to 'A'

to achieve this using SQL i guess we need to make a VOC entry first, define the metadata and then fire the update right?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Ordinarily the entry for the field definition would be in the file dictionary rather than the VOC file. If you want to use SQL to change the record, then you will also need a VOC entry for the hashed file itself.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
zulfi123786
Premium Member
Premium Member
Posts: 730
Joined: Tue Nov 04, 2008 10:14 am
Location: Bangalore

Post by zulfi123786 »

Thanks Ray.
Post Reply