COUNT Problem
Moderators: chulett, rschirm, roy
COUNT Problem
Hi !
I need to run COUNT filename command without " in file name
COUNT HASH1
not
COUNT 'HASH1'
How to remove ' from command before I do DSExecute ?
I need to run COUNT filename command without " in file name
COUNT HASH1
not
COUNT 'HASH1'
How to remove ' from command before I do DSExecute ?
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Don't put it in there in the first place, and you won't need to remove it.
or The fourth argument contains the number of records counted (or a negative value if there was an error), so you don't even have to parse the third argument. But you can if you want to.
Code: Select all
Call DSExecute("UV", "COUNT hashedfile", Output, SystemReturnCode)
Code: Select all
HashedFileName = "hashedfile"
Call DSExecute("UV", "COUNT " : HashedFileName, Output, SystemReturnCode)
Code: Select all
RecordCount = Oconv(Output,"MCN")
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Code: Select all
FUNCTION CountHashedFile(HashedFileName)
Command = "COUNT " : HashedFileName
Call DSExecute("UV", Command, Output, SystemReturnCode)
Ans = SystemReturnCode
RETURN(Ans)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Code: Select all
Command = "COUNT " : Arg1
Call DSExecute("UV", Command, Output, Code)
Call DSLogInfo("Command = ": Command, "CountHashedFile")
Call DSLogInfo("Output = " : Quote(Output) : @FM : "Code = " : Code, "CountHashedFile")
Ans = Code
*******
Arg1 = VOC
Test completed.
DSLogInfo called from : CountHashedFile
Message to be logged is...
> Command = COUNT VOC
DSLogInfo called from : CountHashedFile
Message to be logged is...
> Output = "
> 4746 records counted.
> "
> Code = 4746
Result = 4746
DataStage version 7.5, server HP-UX 11.0
I think it must have something to do with the way the command is being passed through Windows, since this is the only difference apparent in our two scenarios. I won't have access to a Windows server this week; maybe someone else can replicate the test.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Found it!
The problem is the mixed case table name. UniVerse (DataStage) puts the quotes on when there's a non-all-upper-case name. This also occurs through the Command window of the Administrator client.
Can't find a solution using COUNT verb, but you can use quoted identifiers in SQL. For example
The problem is the mixed case table name. UniVerse (DataStage) puts the quotes on when there's a non-all-upper-case name. This also occurs through the Command window of the Administrator client.
Can't find a solution using COUNT verb, but you can use quoted identifiers in SQL. For example
Code: Select all
SELECT COUNT(*) FROM "hashedfile";
Code: Select all
Command = "SELECT COUNT(*) FROM " : DQuote(HashedFileName) : ";"
Call DSExecute("UV", Command, Output, SystemReturnCode)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact: