function statement error in datastage server routine (BASIC). Very simple but didn't working - basic

I have problem with using datastage server routine function statement.
Would you please notice me to what is problem with my code?
It is simple but I don't know why didn't work...
The code is
$INCLUDE DSINCLUDE JOBCONTROL.H
FUNCTION GetTS(A,B)
ARG1 = A:B
RETURN(ARG1)
DEFFUN GetTS(A,B)
S='aaa'
K='bbb'
txt = GetTS(S,K)
Ans = txt
And error message is
Compiling: Source = 'DSU_BP/DSU.Test02', Object = 'DSU_BP.O/DSU.Test02'
************************************************?
Line 0002
1 Errors detected, No Object Code Produced.
Normaly error message says what problem is, but this time is not...

I Found Something. Server routins is one of Function statement.
So Function statement in Server Routine is impossible.

Related

Conversion error If value = "" Then

I'm getting a error I can't quite explain I have a Excel list I want to load into memory, to see if the next row is still a relative row I check if the cell has a value by doing If value = "" Then but the value is 1012738 and it gives me a unhandled exception...
I can't quite understand why the code is giving a error, the cell value is formatted just like all previous cells that were checked. But here a error is thrown.
Maybe i'm just not seeing it, and someone can explain?
You should check the value each time.
Dim o As Object = oSheet.Range(xxx).Value
If (o IsNot Nothing) Then
Select Case o.GetType
Case GetType(Double)
' do work here
Case GetType(Integer)
' do work here
...
End Select
Else
...
End If
Your image isn't showing up for me.
Most exceptions in excel are datatype related. Most likely, you either have a NULL or a string that looks like an integer to the human eye. You can blindly try using trim(), int() or str() etc as needed to make sure you're actually testing an integer or matching a string if thats what you are about or you can test them in a programmatic method.
First, the programmatic method of testing ... isEmpty or isNull are needed to ensure the cell is good ...
if isEmpty(value) Then
<do something>
This will most likely catch the error which is causing the message. If empty is failing, try testing with isNull. One means the cell is empty, the other means that it wasn't initialize (rarely an issue in excel, but if using vba code it can happen).
Also ... your if statement is setup in a less than optimal... used <> in place of if then + else ...
Your code ...
If value = "" Then
General formula when you want to test that something is not something else, use the not equals ...
if value <> "value" Then
"some operation"

headerlinesIn not working correctly in importdata MATLAB

I am importing some data from the excel and the code looks like this:
Code:
%Import Data
filename = 'Stocks.xlsx';
delimiterIn = ' ';
headerlinesIn = 1;
A = importdata(filename,delimiterIn,headerlinesIn);
The excel file looks like this:
When I read in the data, A looks like this:
I thought when the headerlineIn = 1, the first line should not read. Why is it that it is being read? How to avoid this?
Need some guidance..
How I thought your code is alright.
With your example file and your code I get a struct A.
A = importdata('Stocks.xlsx',' ',1);
In A.data.Sheet1 is all the data correctly read:
And in A.textdata.Sheet1 the appears what you posted you get.
So the problem must be something I can't reproduce.
Alternatively you could try if xlsread works for you.
B = xlsread('Stocks.xlsx',1)
I get the same result as before.
I finally get your problem, you're not concerned about the data, you really want to skip the first line of the header in the means of textdata.
Well headerlinesIn just signalizes importdata when your data starts, respectively when it should start to read actual data. Everything else, which is then declared not to be data, is put into A.textdata.Sheet1, also the first line. So the code works as intended.
If you want to get rid of the first line of your header, you could apply the following line:
N = 2; %// number of columns before data starts
A.textdata.Sheet1 = {A.textdata.Sheet1{headerlinesIn+1:end,1:N}};

Expected array when calling function

I'm trying to learn a little VBA an I'm in the process of saving ranges as CSV files.
However, I'm having trouble with this line of code
Call SaveRangeAsCSV(SelectDown("B5:D5"), "C:\Test\test.csv", True)
And here is a snippet of the SelectDown function.
Private Function SelectDown(Range As String) As Range
SelectDown = Range(Range, ActiveCell.End(xlDown)).Select
End Function
I get the error: Expected array. I cannot seem to understand what the problem is. Any help would be appreciated :-)
It sounds like the function SaveRangeAsCSV is expecting an array, but you are passing in a Range. This function is not a built-in Excel function, so I can't check it. Maybe you could check what arguments it is expecting?
My function now looks like this and is working perfectly.
Private Function SelectDown(RangeAddress As String) As Range
Set SelectDown = Range(RangeAddress, ActiveCell.End(xlDown))
End Function

Lotus Notes Script Error: Field count mismatch

In my Lotus Notes script, i do have this piece of logic as shown below. This is basically for two SELECT statements, followed by Fetch for each of the SELECT statement separately and the SELECT is for the same DB2 table with a variation in WHERE clause. The error i'm getting is for the second FETCH. The error i'm getting is ---> Field count mismatch error:
count = 0
If (srccon.Execute(selectstatement, fldLst1) = 0) Then
Goto GetNextDoc
End If
count = srccon.Fetch(fldLst1)
If ( count = 0 ) Then
Goto GetNextDoc
End If
The above cursor select and fetch does not give me any error.
The cursor down which is for the same DB2 table with a slight variation
in WHERE clause is causing the error:
count1 = 0
If (srccon.Execute(selectstatement1, fldLst) = 0) Then
Goto GetNextDoc
End If
count1 = srccon.Fetch(fldLst) ---> The error is pointing to this line
and the error is
I would appreciate any help in this regard. I would also thank the gentleman who
did excellent solution for my previous problem for current date minus 30 days.
With much thanks
I suspect it's because when you call Execute, you're reusing the same LCFieldList object from a previous call. Execute and Select statements append their list of result fields to the object you pass them, so you must pass them an empty fieldlist -- one you just created. Otherwise you get a combined fieldlist of all the fields in the result sets of multiple calls to Select or Execute.
You may find the LotusScript chapter of this Redbook useful.

Getting error in If condition if I use 'AND'

I'm trying to make an if condition that checks a couple of things using 'And', and I get an error everytime
This is my if condition:
If rs.Fields("NM").Value = dictNM.Key[0] And rs.Fields("NODE_CD") = dictCD.Key[0] And rs.Fields("DT") = dictDT.Key[i] Then
Error:
Compile Error: Expected Then or GoTo
It is the [] that are the problem. It needs to be () in VB(A).
Try using () in each condition
And wich lenguage is exactly ? Looks like VB, but it may be another

Resources