View previous topic :: View next topic
|
Author |
Message |
abin
Active User
Joined: 14 Aug 2006 Posts: 198
|
|
|
|
Can we use a statement as following
SET INDEX-A TO INDEX-B
Where INDEX-A and INDEX-B are two indexes defined with two different tables of different length. |
|
Back to top |
|
|
shrinivas_3 Warnings : 1 New User
Joined: 05 Sep 2006 Posts: 34
|
|
|
|
abin wrote: |
Can we use a statement as following
SET INDEX-A TO INDEX-B
Where INDEX-A and INDEX-B are two indexes defined with two different tables of different length. |
Hi
yes you can have SET INDEX-A TO INDEX-B
THanks
Shrinivas D |
|
Back to top |
|
|
abin
Active User
Joined: 14 Aug 2006 Posts: 198
|
|
|
|
Hi Shrinivas,
Thanks for the reply the code is working fine.
Coould you please elaborate how the conversion takes place or
suggest a link or material where I can know about it in detail
Thanks. |
|
Back to top |
|
|
UmeySan
Active Member
Joined: 22 Aug 2006 Posts: 771 Location: Germany
|
|
|
|
Hi !
Don't worry about how this fucking conversation takes place, cause it's only a simple move. Both fields are only counters.
SET Ind1 to Ind2. If Ind2 = 4, then SET Ind1 to 4 is the same.
Regards, Umeysan |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Not being subscripts (which are actually counters) I thought indexes represented actual displacement of the row into the table.
If Ind2 were an index of a different table than Ind1 then setting 1 to 2 would make 1 point to the row in 2's table, wouldn't it?
If the rows had different lengths, wouldn't Ind1 point incorrectly into its own table? |
|
Back to top |
|
|
abin
Active User
Joined: 14 Aug 2006 Posts: 198
|
|
|
|
This same doubt, which William raised came to my mind, thats wy I posted this question. But clearly the code works fine this is what makes my head ring. I searched IBM manuals where I saw a simillar situation
Please see the code below
Example: PERFORM and indexing
This example traverses an error flag table using indexing until an error code that
has been set is found. If an error code is found, the corresponding error message is
moved to a print report field.
. . .
***********************************************************
*** E R R O R F L A G T A B L E ***
***********************************************************
01 Error-Flag-Table Value Spaces.
88 No-Errors Value Spaces.
05 Type-Error Pic X.
05 Shift-Error Pic X.
05 Home-Code-Error Pic X.
05 Work-Code-Error Pic X.
05 Name-Error Pic X.
05 Initials-Error Pic X.
05 Duplicate-Error Pic X.
05 Not-Found-Error Pic X.
01 Filler Redefines Error-Flag-Table.
05 Error-Flag Occurs 8 Times
Indexed By Flag-Index Pic X.
***********************************************************
*** E R R O R M E S S A G E T A B L E ***
***********************************************************
01 Error-Message-Table.
05 Filler Pic X(25) Value
?Transaction Type Invalid?.
05 Filler Pic X(25) Value
?ShiftCode Invalid?.
05 Filler Pic X(25) Value
?Home Location Code Inval.?.
05 Filler Pic X(25) Value
?Work Location Code Inval.?.
05 Filler Pic X(25) Value
?LastName - Blanks?.
05 Filler Pic X(25) Value
?Initials - Blanks?.
05 Filler Pic X(25) Value
?Duplicate Record Found?.
05 Filler Pic X(25) Value
?Commuter Record Not Found?.
01 Filler Redefines Error-Message-Table.
05 Error-Message Occurs 8 Times
Indexed By Message-Index Pic X(25).
. . .
PROCEDURE DIVISION.
. . .
SetFlag-Index To 1
Perform Until No-Errors
Search Error-Flag
When Error-Flag (Flag-Index) = Error-On
Move Space To Error-Flag (Flag-Index)
SetMessage-Index To Flag-Index
Move Error-Message (Message-Index) To
Print-Message
Perform 260-Print-Report
End-Search
End-Perform
. . .
Chapter 4. Handling tables 65 |
|
Back to top |
|
|
UmeySan
Active Member
Joined: 22 Aug 2006 Posts: 771 Location: Germany
|
|
|
|
Hi Will !
I assume "abin" is talking about normal cobol indexes used in occurse clause. These are the tables he mentioned. So there, indexes are only pointers to the row of the occ-table. If you want to have a parallel access to such both tables you could set both indexes to the same content.
There's no pointing into a row of the table, only to the beginning of the entry in a table. But I think, you're really familiar to what i'm talking here.
Regards, merry christmas & happy new year
UmeySan (Germany) |
|
Back to top |
|
|
abin
Active User
Joined: 14 Aug 2006 Posts: 198
|
|
|
|
Thanks for your support guys,
I think some sort of internal conversion is happening there.
Any clarrification on this will be a pleasure.
Thanks.
Merry X'Mas and Happy new year. |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Well, I can see (since the math is done at the time of the set) that COBOL must be saving two things under the cover for indexes, the first being the actual displacement that the index represents and the other must be the actual count. A table associated index must have the row length also saved.
If I set 1 to 2, it must be altering the count and calculating the displacement.
If Ind3 is ws defined with usage index, and I set 3 to 2, I would think that 2's displacement and count would just get pluged int 3. Or would just the count be altered (just like a subscript) until 3 was used in a table so the displacement would be correct for whatever table it was used on.
This is too muchy for this early on a Friday morning... |
|
Back to top |
|
|
UmeySan
Active Member
Joined: 22 Aug 2006 Posts: 771 Location: Germany
|
|
|
|
Hi Will !
I realise, you really bother yourself about this shity command.
This makes life unpleasant for you.
The displacement would be correct for any time, cause it's always the beginning point of a table entry (table-element).
So believe it or not. Now, i'm more than 30 years in this job, mostly as a systemprogrammer programming in assembler, the one and only intelligent language for that shity piece of iron there, standing in the
basement of some companies. I don't spend too much time thinking of the internal analytical explosion of a cobol command when he is working the way i want him to. An i could'nt understand all these guys, discussing same problem over and over again. That makes me a little bit nervous about think of the quality of software, they are programming.
Btw. The ABS and ESP in the MERCEDES Car's is programmed in C++ and
visual-c. Mostly by young programmers in ungary. Since the time i knew, i have a very strange feeling using my brakes on german autobahn's when driving with the top-speed of my car, mercedes S6000 from BRABUS.
If you have to much time, please read my little article in JCL-section
"more than 255 steps" to understand my meaning.
So, for now, best Regards, merry christmas & happy new year
UmeySan (Germany) |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
UmeySan wrote: |
I realise, you really bother yourself about this shity command.
This makes life unpleasant for you. |
No, not unpleasant nor a bother.
Quote: |
So believe it or not. Now, i'm more than 30 years in this job, mostly as a systemprogrammer programming in assembler, the one and only intelligent language for that shity piece of iron there, standing in the
basement of some companies. |
You have my sympathy, the last time I worked on an MF in a basement was over around 1972.
Quote: |
I don't spend too much time thinking of the internal analytical explosion of a cobol command when he is working the way i want him to.
|
That is just fine, for you, and when pressed, I treat such the same.
But I have always enjoyed trying to understand complex issues. I have found that the more I can comprehend the problem the better a solution can be crafted. |
|
Back to top |
|
|
Bitneuker
CICS Moderator
Joined: 07 Nov 2005 Posts: 1104 Location: The Netherlands at Hole 19
|
|
|
|
And my 2 cent there too |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Bitneuker wrote: |
And my 2 cent there too |
Read them both shortly after you each posted.....And I agree..... |
|
Back to top |
|
|
UmeySan
Active Member
Joined: 22 Aug 2006 Posts: 771 Location: Germany
|
|
|
|
Hi Will !
"You have my sympathy, the last time I worked on an MF in a basement was over around 1972."
Oh guy, it's a real pleasure for me to do that. And btw., 1972 i was programming for NORAD COMMAND for your AirForce, 150 meters below the ground in the Cheyenne Mountains. A real great inspirational location. I really miss it. ;-)
"But I have always enjoyed trying to understand complex issues. I have found that the more I can comprehend the problem the better a solution can be crafted"
I apologize, i'm still doing the same. Perhaps i'm so blockheaded that i could not grasp the basics of the complex issues of a set-index command.
By courtesy, I prefere a right honourable adress in the beginning of a mail and the obligatory signature at the end. Anyway the manner of expression or the language of the gutter in the note is. So much time, one has to spend.
It had been a pleasure to me to discuss these several aspects with you.
Thank's a lot, Regards & have a nice Christmas
UmeySan
Live well & prosper
UmeySan |
|
Back to top |
|
|
|