How to Deploy/compile multiple Stored Procedures using IBM Data Studio? - stored-procedures

I am using IBM data studio 4.1.2 client to connect to DB2 data base. I want to know how to deploy(compile) multiple Stored procedures(SP) at once. It was very straight forward and easy in Toad. But unfortunately I cannot use Toad because of some company policy of mine.
In Data Studio I tried these 1) Data source explorer -> Schema -> Stored procedure -> right click -> new stored procedure -> wrote two simple SP one after the other. 'END' of first SP asked 'Statement terminator expected', When I put ';' after END then 'Statement terminator expected instead of ;', when I used '--' at the top then all statements including BEGIN statement of second SP giving syntax error 'END was expected to form a complete scope'. I tried all possible workarounds, But still same syntax error.
I am 100 % sure that there is nothing wrong in SP. But I don't know what is the solution for this. I had gone through lot many IBM support pages, tutorials, demo. All of them demonstrates how to compile one SP at a time opening separate editor window. Actually I have to deploy 300 odd SPs. Please Help me.
This question is not a duplicate of other as This is related to Multiple SP deployment using IDE.

Related

Reading COBOL code with .NET to generate a call graph

I am working on a project to automate COBOL to generate a class diagram. I am developing using a .NET console application. I need help tracking down the procedure name where the perform statement in used in the below example.
**Z-POST-COPYRIGHT.
move 0 to RETURN-CODE
perform Z-WRITE-FILE**
How do I track the procedure name 'Z-Post-COPYRIGHT' where the procedure 'Z-write-file' is called? The only idea I could think of in terms of COBOL is through indentation as the procedure names are always indented. Ideally in the database, the code should track the procedure name after the word 'perform' and procedure under which it is called (in this case it is Z-POST-COPYRIGHT).
I assume you want to do this "on your own" without external tools (a faster approach can be found at the end).
You first have to "know" your source:
which compiler was it compiled with (get a manual for this compiler)
which options were used
Then you have to preparse the source:
include copybooks (doing the given REPLACING rules if any)
if the source is in free-form reference format: concatenate contents of last line and current line if you find a - in column 7
check for REPLACE and change the result accordingly
remove all comments (maybe only * and \ in column 7 in fixed-form reference format or similar (extensions like "variable" format / "terminal" format", ... exist, maybe only inline comments - when in free-form reference-format, otherwise maybe inline comments *> or compiler specific extensions like |) - depending on the further re-engineering you want to do it could be a good idea to extract them and store them at least with a line number reference
The you finally can track the procedure name with the following rule:
go backwards to the last separator period (there are more rules but the rule "at least one line break, another period, a space a comma or a semicolon" [I've never seen the last two in real code but it is possible" should be enough)
check if there is only one word between this separator period and the next
if this word is no reserved COBOL word (this depends on your compiler) it is very likely a procedure name
Start from here and check the output, then fine grade the rule with actual false positives or missing entries.
If you want to do more than only extract the procedure-names for PERFORM and GO TO (you should at least check the sources for PERFROM ... THRU) then this can get to a lot of work...
Faster approach with external tools:
run a COBOL compiler on the complete sources and tell it to do the preparsing only - this way you have the big second point solved already
if you have the option: tell the compiler or an external tool to create a symbol table / cross reference - this will tell you in which line a procedure is and its name (you can simply find the correct procedure by comparing the line)
Just a note: You may want to check GnuCOBOL (formerly OpenCOBOL) for the preparsing and/or generation of symbol tables/cross-reference and/or printcbl for a completely external tool doing preparsing and/or cobxref for a complete cross reference generation.

How to locate the field that produces the “data type mismatch” exception?

I have a really long insert query with more than 40 fields (from an 'inherited' Foxpro database) processed using OleDb, that produces the exception 'Data type mismatch.' Is there any way to know which field of the query is producing this exception?
By now I'm using the force brute method of reducing the number of fields on the insert until I locate the buggy one, but I guess it must be a more straight way to found it...
There isn't really any shortcut beyond taking a guess at which 20 might be the problem, chopping out the other 20 and testing, and repeating that reductive process until you hit it.
Or alternatively looking at the table structure(s) in the DBF and making sure the field types match to the OleDB types you're using. The details of how .NET types are mapped to Visual FoxPro table field types is here.
If you have access to the Visual FoxPro IDE you could probably do that a lot quicker by knocking up a little program or even just doing it in the Command Window.
You are not telling us the language you use, so that we could possibly give a sample to handle it.
Basically what you would do is:
Get the structure,
Parse the insert statement and get values,
Compare data types.
It should be a short code to make this check.

Impala Column Name Issue

We are facing a problem with Imapla Column naming convention which seems unclear to us.
The CDH imapala documentation (http://www.cloudera.com/documentation/archive/impala/2-x/2-0-x/topics/impala_identifiers.html) 3rd bullet point says : An identifier must start with an alphabetic character. The remainder can contain any combination of alphanumeric characters and underscores. Quoting the identifier with backticks has no effect on the allowed characters in the name.
Now, due to dependency with the upstream SAP systems, we had to name a column name starting with (0) zero as numeric. While defining and extracting the records from the table impala does not show any semantic error. While connecting Imapala with SAP HANA through SDA (Smart Data Access), the extraction is failing for this particular column which is starting with a leading zero (0) and fine for rest of the columns which are starting with an alphabet. The error shows as "... ^ Encountered: DECIMAL LITERAL "
I have to points.
If the documentation says, an identifier can not start anything other that alphabet, then how the imapla query is running without any issues.
Why the error is only raised while it is getting extracted from SAP HANA.
Any insight will be highly appreciable.
Ok, I can only say something about the SAP HANA side here, so you will have to check the Impala side somehow.
The error message you get while accessing an external table via SDA typically comes from the 3rd party client software, in this case the ODBC driver you use to connect to Impala.
So, SAP HANA tries to access the table through the Impala ODBC driver and that driver returns the error message.
I assume that the object name check for Impala is implemented in the client in this case. Not sure if the way you use to run the query in Impala also uses the driver.
But even if Impala has the limitation for the table naming in place, I fail to see why this would force you to name the table in SAP HANA that way. If the upstream data access requires the leading 0 just create a view on top of the table and you're good to go.

Is Oracle's syntax diagram for PL/SQL blocks wrong?

I suspect that the syntax diagram for a plsql_block as given in the
Oracle® Database PL/SQL Language Reference for Relese 2 is wrong.
(For reference, here's the current link to that document)
The following piece of PL/SQL compiles fine:
declare
cursor
cursor_definition
is select * from dual;
variable_declaration number;
begin
null;
end;
The following statements are assumptions that I make based on the piece of PL/SQL above and based on Oracle's syntax diagram.
The declare section (above) consists of a cursor definition followed by a variable declaration (which in turn is an item declaration).
An item declaration can only be an element of an item list 1.
A cursor definition can only be an element of an item list 2.
An item list 2 can never be followed by an item list 1.
Now, the variable declaration following the cursor definition contradicts point 4. Therefore I conclude that the
syntax diagram is wrong.
Maybe I am overlooking something, in which case I'd be very grateful for pointing this out to me.
Please understand that a wrong syntax diagram per se is no big deal to me. But I am in the process of writing a PL/SQL parser
and the parser stumbles for the exact situation given with the example PL/SQL code. So, in order to improve the parser, I'd like
to have a more authorative sequence diagram.
I concur. The syntax diagrams explicitly state that a plsql_block is effectively item_list_2 preceded by an optional item_list_1.
Further, cursor definitions (with the is bit) can only occur in item_list_2 and variable declarations (with or without an =) are part of the item_declaration set and can therefore only be in item_list_1.
Those facts make your code sample incorrect so, if it manages to compile, then either:
the syntax diagrams are wrong; or
the compiler doesn't follow them to the letter; or
your looking at code that's covered by different syntax diagrams.
On that last bullet point, interestingly enough, the syntax diagrams for 11.1 are slightly different.
The declare section can be item_list_1 or item_list_2 or item_list_1 followed by item_list_2.
Where it gets interesting is that item_list_1 can have any number of item_declaration entries and this includes both variable_declaration and cursor_declaration.
In 11.1, a cursor_declaration can be either a declaration or a definition, based on the language elements in 11.2 (in other words, there is no cursor_definition type since the declaration allows both in the declaration).
So what you have is perfectly valid in 11.1 so the first thing I'd check is that you're actually running 11.2 where that successful compilation is taking place.
It's still possible of course that you're running 11.2 and the syntax diagrams are wrong, in which case you should complain bitterly to Oracle but I don't know what sort of a response you'll get from a company whose flagship database product can't tell the difference between an empty varchar and a NULL (a).
(a) I'll never pass up an opportunity to mention this and advance the cause of my beloved DB2 :-)

MySQL stored procedure porting?

I am having a great deal of trouble porting some stored procedures to regular MySQL statements.
We have stuff like this example
http://dev.mysql.com/doc/refman/5.0/en/stored-programs-defining.html
BEGIN
SET #x = 0;
REPEAT SET #x = #x + 1; UNTIL #x > p1 END REPEAT;
END
Where many statements are executed. Several If statements and variable declarations, the whole 9 yards. But for some reason I can't just copy and paste the logic of the stored procedure into MySQL's query browser and execute it nor will it execute in a query execution via a C# program
I tried porting these queries via parameterized queries in C# but I still get a "check the manual error" every time =O
I really need help i can't find an answer anywhere on the internet. Am I completely screwed trying to get sequential execution without stored procedures?
Is the only way to do this to port the logic to the actual program? (I really don't want to do this)
Edit: I have reading comprehension issues. This link says that the looping constructs only work within stored programs, so you are out of luck I think.

Resources