473,396 Members | 1,827 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Views and union...

Here is my case :

CREATE view v1 AS
(SELECT 'E' as language,
Field1,
Field2 from libE/table1
union
SELECT 'F' as language,
Field1,
Field2 from libF/table2)

Where Field1 is the PK.
And the tables have 10 000 rows.

Then two identical files in two librairies. One per language, french
and english. We want to access these files in Cobol. We added a new
field for the language to be able to do a quick start in cobol if it
is possible. I tried to do a DBU on it and DBU doesn't see any row.
In SQL it works perfectly and it seems to be really quick. The PK
indexes have been selected.

Then my question is: is it possible to access my view with a start in
a Cobol, on the fields "language" and "Field1".

If it is not possible with this solution, how can I could do that ?

Note, I know that I could use and embeded SQL in my Cobol, but I'm
screared of the poor performance.

Thanks a lot.
Nov 18 '08 #1
4 2737
Ram
Haven't understood your question completely but if the two tables are
having distinct (non-duplicate) records, then you may want to change
the UNION to UNION ALL to avoid an unnecessary sort.

Best regards,
ram

Karlitos wrote:
Here is my case :

CREATE view v1 AS
(SELECT 'E' as language,
Field1,
Field2 from libE/table1
union
SELECT 'F' as language,
Field1,
Field2 from libF/table2)

Where Field1 is the PK.
And the tables have 10 000 rows.

Then two identical files in two librairies. One per language, french
and english. We want to access these files in Cobol. We added a new
field for the language to be able to do a quick start in cobol if it
is possible. I tried to do a DBU on it and DBU doesn't see any row.
In SQL it works perfectly and it seems to be really quick. The PK
indexes have been selected.

Then my question is: is it possible to access my view with a start in
a Cobol, on the fields "language" and "Field1".

If it is not possible with this solution, how can I could do that ?

Note, I know that I could use and embeded SQL in my Cobol, but I'm
screared of the poor performance.

Thanks a lot.
Nov 19 '08 #2
On 18 nov, 23:10, Ram <ram...@gmail.comwrote:
Haven't understood your question completely but if the two tables are
having distinct (non-duplicate) records, then you may want to change
the UNION to UNION ALL to avoid an unnecessary sort.

Best regards,
ram

Karlitos wrote:
Here is my case :
CREATE *view v1 AS
* (SELECT 'E' as language,
* * * * * Field1,
* * * * *Field2 from libE/table1
union
SELECT 'F' as language,
* * * * * Field1,
* * * * *Field2 from libF/table2)
Where Field1 is the PK.
And the tables have 10 000 rows.
Then two identical files in two librairies. *One per language, french
and english. * We want to access these files in Cobol. *We added a new
field for the language to be able to do a quick start in cobol if it
is possible. *I tried to do a DBU on it and DBU doesn't see any row.
In SQL it works perfectly and it seems to be really quick. *The PK
indexes have been selected.
Then my question is: is it possible to access my view with a start in
a Cobol, on the fields "language" and "Field1".
If it is not possible with this solution, how can I could do that ?
Note, I know that I could use and embeded SQL in my Cobol, but I'm
screared of the poor performance.
Thanks a lot.- Masquer le texte des messages précédents -

- Afficher le texte des messages précédents -
Note i'm on a AS400 system.

My files are identical. There is a french version and a english
version in two librairies. I want to merge them with a language code
in the first column.

I added the ALL keyword and it seems that DBU is able to read now.

I want to read this view with Cobol. Is it possible ? And if yes,
can I do a direct read with the PK of the orginal files ?

THanks.
Nov 19 '08 #3
The columns in a UNION have no names, so you need to provide them

CREATE VIEW Foobar (language_code, field1, field2 )
AS
* (SELECT 'EN' , -- use ISO Standards
* * * * *field1, field2
FROM libE/table1
UNION ALL
SELECT 'FR'
field1, field2
FROM ibF/table2);
Nov 19 '08 #4
On 19 nov, 09:19, --CELKO-- <jcelko...@earthlink.netwrote:
The columns in a UNION have no names, so you need to provide them

*CREATE VIEW Foobar (language_code, field1, field2 )
*AS
** (SELECT 'EN' , -- use ISO Standards
** * * * *field1, field2
* * * FROM libE/table1
*UNION ALL
*SELECT 'FR'
* * * * * field1, field2
* FROM ibF/table2);
It doesn't help me neither, but I didn't know that there was a
standard for language code. Thanks.
Nov 19 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: SM | last post by:
/* problem: Trying to get partitioned views to "prune" unneeded partitions from select statements against the partitioned view. There are 5 partitioned tables. Each with a check constraint...
8
by: Mike N. | last post by:
Hello: I am new to T-SQL programing, and relativly new to SQL statements in general, although I have a good understanding of database theory. I'm a little confused as to the fundamental...
3
by: Claudio Lapidus | last post by:
Hello list I have two tables with identical structure, one holds 'correct' data (from an application standpoint) and the other has data 'in error'. Anyway, I need sometimes to query both tables...
8
by: lyn.duong | last post by:
Hi, I have a large table (about 50G) which stores data for over 7 years. I decided to split this table up into a yearly basis and in order to allow minimum changes to the applications which...
2
by: Otto Blomqvist | last post by:
Hello ! I have two tables (which contains individual months' data). One of them contains 500 thousand records and the other one about 40k, 8 columns. When I do a simple query on them...
2
by: dbuchanan52 | last post by:
Hello, I am building an application for Windows Forms using. I am new to SQL Server 'Views'. Are the following correct understanding of their use? 1.) I believe a view can be referenced in a...
28
by: mooreit | last post by:
The purpose for my questions is accessing these technologies from applications. I develop both applications and databases. Working with Microsoft C#.NET and Microsoft SQL Server 2000 Production and...
33
by: Peter | last post by:
People are telling me it is bad to put select * from <atable> in a view. I better should list all fields of the table inside the definition of the view. I dont know exactly why but some...
3
by: jonceramic | last post by:
Hi All, I need to know the best way to set up a datawarehouse/materialized view for doing statistics/graphs in Access. My crosstabs and unions are getting too complicated to crunch in real...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.