Page 1 of 1

DsRoutines

Posted: Sat Jan 19, 2008 12:43 am
by tkbharani
I am writing a routine as follows. It selects data from Hash File.
-----------------------------------------------------------
$IFNDEF JOBCONTROL.H
$INCLUDE DSINCLUDE JOBCONTROL.H
$ENDIF
LenJobName='30L'

Command = "SELECT CIRCLE FROM GEO "
Command := " WHERE CODE= ": Code :" ;"

Call DSExecute("UV",Command,Output,Code)
Ans=Output
@USER1 = Ans

MainExit:
Return(Ans)
-------------------------------------------------------------

The out I am getting as follows.
==================================
TEST #1
*******

Arg1 = 9324

Test completed.


Result = CIRCLE

MU

1 records listed.
==================================

I need to get only the value of the column,that is I need only MU .
I dont need column heading CIRCLE_CD and 1 records listed. The actual result is MU only.How to frame the query to avoid column headings.

Posted: Sat Jan 19, 2008 1:05 am
by ray.wurlod
Using a routine is going to be WAY too slow. However, the answer to your actual question is that what is returned is the entire output of the command - you have to isolate the field (line) in which your result is displayed, for example Field(Output,@FM,3,1) or simply Output<3>.

The SQL could include a SUPPRESS COLUMN HEADING clause, but the output field number would be (at a guess) 2 not 3.

But far, far better would be simply to use the hashed file as a conventional lookup, supplying a reference input to a Transformer stage.

Hint Please....

Posted: Sat Jan 19, 2008 1:59 am
by tkbharani
Can you please tel me how to delimit a the following output

I am using Field function as follows
Subst = Field(Output, " ", 1)

But I am not getting value,how to delimit the following
UASL_CIRCLE_CD

MU

1
Hint please :wink:

Re: Hint Please....

Posted: Sat Jan 19, 2008 3:13 am
by tkbharani
I got the desired output. using the command as follows.

Subst = Field(Output, @FM, 3)

where 3 is the third formated result.
thanks for reply Mr.Ray