IWETHEY v. 0.3.0 | TODO
1,095 registered users | 0 active users | 0 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New Time to learn C
Today the boss asks me to look into why certain files are not sending specific records downstream. They're in our SQL tables, so the fault lies inside the extract program that pulls them out based upon SQL statement criteria.

BUT our high quality, straight from Pune and/or Bangalore C programmers don't use 'SELECT' statements, they use VIEWS to choose the data and encode the logic for the extracts. So I have to decipher the programs and track down where they hide the creation statements for the views to see what really is happening under the hood. In the meantime, I have to step through the code in a high level debugger and see what the data variables contain to figure out what's going on.

On a positive note, once I get the C language on my resume it'll open up more doors for me, both on and off the Tandem.

So, any advice on how to learn C quickly and avoid any commonly known pitfalls?
lincoln
"Windows XP has so many holes in its security that any reasonable user will conclude it was designed by the same German officer who created the prison compound in "Hogan's Heroes." - Andy Ihnatko, Chicago Sun-Times
[link|mailto:bconnors@ev1.net|contact me]
New Get the K&R book for starters
The quintessential reference
New Or don't
Sorry, that chestnut is so out of date it's dangerous.
-drl
New Second edition is ANSI C
Which hasn't changed much in the last 20 years.
New OT: er...
*I* would use views for something like that, from the sounds of it, and I'm not from Bangalore...
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New So where do you hide
the file containing the original CREATE VIEW code, so that anybody can see what you're SELECTing, FROM what table(s), and what conditions are in the WHERE clause? Or do databases like Oracle and DB2 allow a complete display of the view somehow?

Even though I know where the files containing the views are, an unfortunate reality of NonStop SQL is that they can't be opened in an editor or copyed for displaying. Inside the SQL, I can do an INVOKE, but it only gives me the columns being selected - no WHERE clause logic whatsoever.

So what's so hard about having a complete SELECT statement within a string buffer within the program so that people besides that author can see what's going on? Oh, right -- job security.
lincoln
"Windows XP has so many holes in its security that any reasonable user will conclude it was designed by the same German officer who created the prison compound in "Hogan's Heroes." - Andy Ihnatko, Chicago Sun-Times
[link|mailto:bconnors@ev1.net|contact me]
New The view itself is defined in the database
if you have god rights to the database, reconstructing the views should be but a query away. Unfortunately, you have to trundle through the Oracle docs to find the right tables/views for reconstruction. Seems like there's some freeware to do that - probably from the Toad people.

[edit doh: for that matter doesn't Toad just let you view the View definitions directly? Realizes that i is missing some piece of the puzzle]
Expand Edited by ChrisR May 26, 2004, 02:44:30 PM EDT
New Re: So where do you hide
Our views are defined in .sql files and loaded by the build system.

Or, with Oracle at least, TOAD or TOra will show you the view definition.

Dunno about NonStop. Seems pretty silly that you can't get the full definition.

So what's so hard about having a complete SELECT statement within a string buffer within the program so that people besides that author can see what's going on?
1) A view is precompiled.
2) A view can have different permissions than the base table.
3) A view can be used with the same built-in logic by more than one program.

No, it isn't "job security".
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New Re: So where do you hide

Dunno about NonStop. Seems pretty silly that you can't get the full definition.

and

3) A view can be used with the same built-in logic by more than one program.

Totally agree with both points.
lincoln
"Windows XP has so many holes in its security that any reasonable user will conclude it was designed by the same German officer who created the prison compound in "Hogan's Heroes." - Andy Ihnatko, Chicago Sun-Times
[link|mailto:bconnors@ev1.net|contact me]
New this might be useful
A few minutes on Google turned up this - [link|http://h71033.www7.hp.com/nsswdocs/sqlodbc/sqlmp_G0613/SQLMP_Install_&_Mgmt_429830.pdf|NonStop SQL/MP Installation and Management Guide](3.3 MB PDF)

Page 6-3(page 161 of PDF) is the beginning of the section Displaying Current Database Defintions

page 6-4 thru 6-5(page 162-163 of PDF) is Displaying Information About Views and has 4 queries listed for extracting a view's tables, columns, ect.

Also, page 3-13 thru 3-14 (69-70) lists some of the advantages to using views.
Darrell Spice, Jr.                      [link|http://www.spiceware.org/cgi-bin/spa.pl?album=./Artistic%20Overpass|Artistic Overpass]\n[link|http://www.spiceware.org/|SpiceWare] - We don't do Windows, it's too much of a chore
Expand Edited by SpiceWare May 26, 2004, 05:45:24 PM EDT
New The IGM strikes again.
New Good find, but not what I needed
I know how to find general info on a view; what I needed was to find the creation of the view.

Here's what I did last night:

1. Find the VIEWS table - since it has a unique filecode of 585, searched the system for any file with that filecode and a name like "views".
2. Opened it up and look for the view name that the code is using.
3. Curse up a storm, because the fuckwads at Tandem who designed this back in the 1970s decided that the actual view name, what you call it, will not be stored in the table, BUT THE ACTUAL 8 CHARACTER FILENAME OF THE FILE THAT CONTAINS THE CREATE VIEW CODE. So you have to figure out which file has the view that you want.
4. Get the right filename through guessing/trial and error, use that to go into the views table and display the CREATE VIEW code using this select:

SELECT SUBSTRING(viewtext FROM 1 FOR 70),
SUBSTRING(viewtext FROM 71 FOR 70),
SUBSTRING(viewtext FROM 141 FOR 70),
SUBSTRING(viewtext FROM 211 FOR 70),
SUBSTRING(viewtext FROM 281 FOR 70),
SUBSTRING(viewtext FROM 351 FOR 70),
SUBSTRING(viewtext FROM 421 FOR 70),
SUBSTRING(viewtext FROM 491 FOR 70),
SUBSTRING(viewtext FROM 561 FOR 70),
SUBSTRING(viewtext FROM 631 FOR 70),
SUBSTRING(viewtext FROM 701 FOR 70),
SUBSTRING(viewtext FROM 771 FOR 70),
SUBSTRING(viewtext FROM 841 FOR 70),
SUBSTRING(viewtext FROM 911 FOR 70),
SUBSTRING(viewtext FROM 981 FOR 70),
SUBSTRING(viewtext FROM 1051 FOR 70),
SUBSTRING(viewtext FROM 1121 FOR 70),
SUBSTRING(viewtext FROM 1191 FOR 70)
FROM views
WHERE viewname like '\\EAIDR.$CAT.SC01IDAT.VPRRI%'
browse access;

This gave me:

(EXPR)
-------------------------------------------------------------------------------

CREATE VIEW \\EAIDR.$CAT.SC01IDAT.VPRRI ( CUSTOMER_NO , SALES_ORGANIZAT
ION_CD , DISTRIBUTION_CHANNEL_CD , DIVISION_CD , PARTNER_FUNCTION_CD ,
PARTNER_COUNTER_NO , SOURCE_NM , BUSINESS_PARTNER_NO , PARTNER_CONTAC
T_NO , CENTRAL_DELETE_ACTIVE_FL , CENTRAL_DELETE_INACTIVE_FL , ISO_COU
NTRY_CD , SOURCE_DT , SYSTEM_UPDATE_DT ) AS SELECT A.CUSTOMER_NO , A.S
ALES_ORGANIZATION_CD , A.DISTRIBUTION_CHANNEL_CD , A.DIVISION_CD , A.P
ARTNER_FUNCTION_CD , A.PARTNER_COUNTER_NO , A.SOURCE_NM , A.BUSINESS_P
ARTNER_NO , A.PARTNER_CONTACT_NO , A.CENTRAL_DELETE_ACTIVE_FL , A.CENT
RAL_DELETE_INACTIVE_FL , A.ISO_COUNTRY_CD , A.SOURCE_DT , A.SYSTEM_UPD
ATE_DT FROM ( ( \\EAIDR.$CAT.SC01IDAT.CUSTPNFU A LEFT JOIN \\EAIDR.$CAT.
SC01IDAT.CUSTOMER B ON A.CUSTOMER_NO = B.CUSTOMER_NO ) LEFT JOIN \\EAID
R.$CAT.SC01IDAT.SLARSCCU C ON ( ( ( ( A.CUSTOMER_NO = C.CUSTOMER_NO )
AND ( A.SALES_ORGANIZATION_CD = C.SALES_ORGANIZATION_CD ) ) AND ( A.DI
STRIBUTION_CHANNEL_CD = C.DISTRIBUTION_CHANNEL_CD ) ) AND ( A.DIVISION
_CD = C.DIVISION_CD ) ) AND ( A.SOURCE_NM = C.SOURCE_NM ) ) WHERE ( (
A.CUSTOMER_NO = B.CUSTOMER_NO ) AND ( ( A.SOURCE_NM = B.SOURCE_NM ) OR
( A.SOURCE_NM = "PGWW79" ) ) ) AND ( ( A.SOURCE_NM = C.SOURCE_NM ) OR
( A.SOURCE_NM = "PGWW79" ) )

--- 1 row(s) selected.


NOW I know what the underlying logic is, so I know why the code is dropping records based upon specific conditions.
lincoln
"Windows XP has so many holes in its security that any reasonable user will conclude it was designed by the same German officer who created the prison compound in "Hogan's Heroes." - Andy Ihnatko, Chicago Sun-Times
[link|mailto:bconnors@ev1.net|contact me]
New Can't you export the view definitions?
Last time I worked with them, you could export the view definition from the DB.
===

Implicitly condoning stupidity since 2001.
New Depends on the permissions...
if I remember Oracle correctly, the select that builds the view can be owned by someone else and permission to view the data can be granted.

Great idea for data hiding; lousy idea for a big shop where business units play turf wars with one another. (Sigh)

New Dammit
I know C! Where's MY job?
-drl
New Been 20 years
since I learned it, so my books are woefully out of date. And I abandoned it for Perl, after coding in it for about 10 years! On the other hand, I suspect the 'C' on the Tandem box is "vintage", so I might be of help. I'll check my bookshelf later.

One book I do remember enjoying, was named (appropriately enough)
C Traps and Pitfalls

[link|http://www.amazon.com/exec/obidos/tg/detail/-/0201179288/104-2825542-9288731?v=glance|http://www.amazon.co...-9288731?v=glance]

It is REALLY good.

Go get it.

I learned from the original K&R book, along with the Xenix man pages.

This is the updated version for ANSI C. Probably a good place to start.
[link|http://www.amazon.com/exec/obidos/ASIN/0131103628/ref=pd_sxp_elt_l1/104-2825542-9288731|http://www.amazon.co...4-2825542-9288731]

This is a must buy:
Standard C Library, The
[link|http://www.amazon.com/exec/obidos/ASIN/0131315099/ref=pd_sxp_elt_l1/104-2825542-9288731|http://www.amazon.co...4-2825542-9288731]

C is NOTHING to start with. A very low level language. Basically a step above assembly with some syntactic sugar. But add in the standard libs and you can do magic. FAST magic.

PJ Plauger is a great tech writer. I've been reading articles from him for years, bought the original version of this book, and it was a very good resource. He also did a series about building the libs from scratch. A good path to go down to really understand what is going on.

If you make it through these books, going through examples, while simultaneously reviewing the crap that other people wrote, you will have a good headstart in the language.
     Time to learn C - (lincoln) - (15)
         Get the K&R book for starters - (ChrisR) - (2)
             Or don't - (deSitter) - (1)
                 Second edition is ANSI C - (ChrisR)
         OT: er... - (admin) - (7)
             So where do you hide - (lincoln) - (6)
                 The view itself is defined in the database - (ChrisR)
                 Re: So where do you hide - (admin) - (1)
                     Re: So where do you hide - (lincoln)
                 this might be useful - (SpiceWare) - (2)
                     The IGM strikes again. -NT - (Another Scott)
                     Good find, but not what I needed - (lincoln)
         Can't you export the view definitions? - (drewk) - (1)
             Depends on the permissions... - (Simon_Jester)
         Dammit - (deSitter)
         Been 20 years - (broomberg)

Department of Redundancy Department
58 ms