Get Column Names from a link/stage using DS Basic

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
fridge
Premium Member
Premium Member
Posts: 136
Joined: Sat Jan 10, 2004 8:51 am

Get Column Names from a link/stage using DS Basic

Post by fridge »

Quick question as its late and I want to sit in the sun (rare in UK)
For reasons too tedious to go into , I am writing a small after routine that needs access to the Names of columns in a sequential stage.

I have been using the DSGet***Info routines to 'navigate' to the relevant stages but cant seem to find a way of extracting a list of names into the basic code.

I have seen some code using STAGECOM<PINNO> notation but was hoping for something a little less mad.

Any help gratefully recieved.

Fridge
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

No easy way without a reverse engineering hack effort. The easiest is to add the column names as the first line in the output sequential file (if it's delimited -- highly recommended). Just check the box in the stage to do this. Now, all you need to do is "head -n1 filename" to get the list.
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
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

I think columns are in field 16 of DS_JOBOBJECTS. They are multivalued. It is pretty easy to hack this if you know where to look. If you do not know how to use multivalues then do not try to do this. The OLETYPE is probably CSeqOutput.
Mamu Kim
fridge
Premium Member
Premium Member
Posts: 136
Joined: Sat Jan 10, 2004 8:51 am

Post by fridge »

Cheers both of you, am now well tanned and able to give a proper response.

I had thought of the csv option but want something that requires a transparent implementation for developers.

I have gone down the reverse engineered hack before and wanted something easier, still it looks like the multivalue approach will have to do.

For info I am writing a lazy way of creating DB2 import scripts on the fly - yeah I know I can use the db2load stage but have issues with the load utility on db2 , locking , resilience , wrong colour etc :-)

Thanks again

Fridge
Post Reply