From: canela on
Hello,

I need some help with tables. I will use an example to help explain
what I am trying to do.

I have two tables: Table 1 and Table 2

Table 1 has a lot of rows returned from the database, let's say I have

ws-results1-table1
ws-results1-name
ws-results1-duty
ws-results1-date-finished
.
.
.

Now, let's say Jane is a person that has many rows in table1 because
she has performed many duties over times which started at different
times, and finished at different times.

I want to grab each unique name from table1, so say I want Jane.
With this key, Jane, I want to go off to the database query another
table, let's say to get her departnment
so let's say in table2 i have

ws-results2-table2
ws-results2-name
ws-department
.
.
.
my question is, while doing this in some form of loop, what is the
best way in cobol to perform this so that let's say, Jane's name comes
up in table1 500 times, but not only as previous. So let's say Jane
came up in index 1 of table1, again in row 300 and row 455, while i
loop through the first table, what is the best way to know it is
unique to store it in table2 ?

I was thinking of moving the first value right away, since it's the
first occurence but I am not sure of what the correct statement to use
to sort of say, store in table 2 as long as it does not exist ?
Comparing the previous valued stored won't be enough .. can anyone
help with this?
From: canela on
okay I am thinking of doing something like this:

- storing the very first value of table 1 into table 2
so say:
idx-table2 = 1
temp-idx-table2

idx-table1 = 1
size-table1 = 500

say earlier in time i stored the first name from table1 into table 2

right before i enter this section i will

add 1 to idx-table2 (so say second time around =2)
temp-idx-table2 = 1

Perform varying 1 by 1 until ( idx-table1 > size-table1 )

Move '0' to ws-name-found

Perform varying 1 by 1 until ( temp-idx-table2 > (idx-table2 - 1) )
If ws-results2-name(temp-idx-table2) = ws-results1-name(idx-
table1)
Move '1' to ws-name-found
end-if
end-perform

If ws-name-found = '0'
Move ws-results1-name(idx-table1) to ws-results2-name(idx-table2)
Add 1 to idx-table2
end-if
end-perform.

I am not sure if there is something better than this. Sorry to
bother :P

From: Anonymous on
In article <f6204afb-bfeb-4859-a6bd-7a4460bda996(a)c4g2000hsg.googlegroups.com>,
canela <vferr094(a)alumni.uottawa.ca> wrote:
>Hello,
>
>I need some help with tables. I will use an example to help explain
>what I am trying to do.

Please do your own homework.

DD
From: Anonymous on
In article <a22f701b-f7c5-4c66-8c9a-e07a34a2caa6(a)c4g2000hsg.googlegroups.com>,
canela <vferr094(a)alumni.uottawa.ca> wrote:
>okay I am thinking of doing something like this:

Please do something like your own homework.

DD
From: Binyamin Dissen on
On Mon, 28 Jan 2008 16:34:21 -0800 (PST) canela <vferr094(a)alumni.uottawa.ca>
wrote:

:>I need some help with tables. I will use an example to help explain
:>what I am trying to do.

:>I have two tables: Table 1 and Table 2

:>Table 1 has a lot of rows returned from the database, let's say I have

:> ws-results1-table1
:> ws-results1-name
:> ws-results1-duty
:> ws-results1-date-finished
:> .
:> .
:> .

:>Now, let's say Jane is a person that has many rows in table1 because
:>she has performed many duties over times which started at different
:>times, and finished at different times.

:>I want to grab each unique name from table1, so say I want Jane.
:>With this key, Jane, I want to go off to the database query another
:>table, let's say to get her departnment
:>so let's say in table2 i have

:> ws-results2-table2
:> ws-results2-name
:> ws-department
:> .
:> .
:> .
:> my question is, while doing this in some form of loop, what is the
:>best way in cobol to perform this so that let's say, Jane's name comes
:>up in table1 500 times, but not only as previous. So let's say Jane
:>came up in index 1 of table1, again in row 300 and row 455, while i
:>loop through the first table, what is the best way to know it is
:>unique to store it in table2 ?

:>I was thinking of moving the first value right away, since it's the
:>first occurence but I am not sure of what the correct statement to use
:>to sort of say, store in table 2 as long as it does not exist ?
:>Comparing the previous valued stored won't be enough .. can anyone
:>help with this?

Why not choose good SQL so that the database engine does the heavy lifting?

Why on earth do you intend to code it this way?

--
Binyamin Dissen <bdissen(a)dissensoftware.com>
http://www.dissensoftware.com

Director, Dissen Software, Bar & Grill - Israel


Should you use the mailblocks package and expect a response from me,
you should preauthorize the dissensoftware.com domain.

I very rarely bother responding to challenge/response systems,
especially those from irresponsible companies.