read by which index? - cobol
This is a discussion on read by which index? - cobol ; "William M. Klein" <wmklein@nospam.netcom.com> wrote in message
news:cJSLk.124904$KY3.40003@fe02.news.easynews.com...
> If your ACCESS Is SEQUENTIAL, then you need to use the START (with the KEY
> IS phrase) and then a bunch of READ NEXT statements.
>
> If your ACCESS ...
-
Re: read by which index?
"William M. Klein" <wmklein@nospam.netcom.com> wrote in message
news:cJSLk.124904$KY3.40003@fe02.news.easynews.com...
> If your ACCESS Is SEQUENTIAL, then you need to use the START (with the KEY
> IS phrase) and then a bunch of READ NEXT statements.
>
> If your ACCESS IS DYNAMIC or RANDOM, then you should just use the READ
> statement and use the KEY IS phrase (as mentioned below).
And what if the Alternate has duplicates? :-) (which, more often than not,
they do...)
(For DYNAMIC, you can also use
> the START, READ NEXT format to sequentially read via the specified key)
>
> Does this help?
I don't know why we're even having this conversation... it's surreal :-)
Pete.
--
"I used to write COBOL...now I can do anything."
-
Re: read by which index?
"William M. Klein" <wmklein@nospam.netcom.com> wrote in message
news:s3TLk.109047$sg2.85748@fe09.news.easynews.com...
> Paul,
> Has anyone yet made the "obvious" statement that it sounds like your
> indexed files with LOTS of alternate indices would be better as an RDB?
> If it is small enough, you might even consider placing it into storage as
> a "table".
>
> However, as it sounds like both of these are out of your scope, then
> simply using the KEY IS phrase for the READ statement (with ACCESS RANDOM
> or DYNAMIC) is the way to go.
Well, I half agree with you, Bill.
I deleted a suggestion to use RDB from my previous post because I figured it
was not an option, but I heartily agree that SHOULD be the solution.
However on using READ (KEY IS...) I think that can only apply for
non-duplicate Alternates.
Pete.
--
"I used to write COBOL...now I can do anything."
-
Re: read by which index?
"Paul H" <NoSpamphobergNoSpam@att.net> wrote in message
news:4900079a$0$5468$bbae4d71@news.suddenlink.net...
> Thanks, all of you. I have it working now. BTW, changing the file
> structures was not an option - many programs already use them as-is.
>
Excellent! Way to go...
Pete.
--
"I used to write COBOL...now I can do anything."
-
Re: read by which index?
In article <6mav50Fftd0jU1@mid.individual.net>,
Pete Dashwood <dashwood@removethis.enternet.co.nz> wrote:
>
>
>"William M. Klein" <wmklein@nospam.netcom.com> wrote in message
>news:cJSLk.124904$KY3.40003@fe02.news.easynews.com...
>> If your ACCESS Is SEQUENTIAL, then you need to use the START (with the KEY
>> IS phrase) and then a bunch of READ NEXT statements.
>>
>> If your ACCESS IS DYNAMIC or RANDOM, then you should just use the READ
>> statement and use the KEY IS phrase (as mentioned below).
>
>And what if the Alternate has duplicates? :-)
I believe that one is notified of this by the value of the field specified
in FILE STATUS clause, Mr Dashwood... did you know that? If so... do you
know what it would be like to live in a world without hypothetical
questions?
[snip]
>(For DYNAMIC, you can also use
>> the START, READ NEXT format to sequentially read via the specified key)
>>
>> Does this help?
>
>I don't know why we're even having this conversation... it's surreal :-)
A fish.
DD
-
Re: read by which index?
In article <6mausmFfuarlU1@mid.individual.net>,
Pete Dashwood <dashwood@removethis.enternet.co.nz> wrote:
>
>
>"Paul H" <NoSpamphobergNoSpam@att.net> wrote in message
>news:48fff97f$0$5477$bbae4d71@news.suddenlink.net...
>> Thanks Jimmy, but my requirement is different. I'm reading another file
>> sequentially, looking for records that satisfy rules (past due). When I
>> encounter a record that qualifies, I need to look the customer up in this
>> file (that has many indices) to get information to display to the user.
>> So
>> I need to do lookups by a pic x(20) key. How do I tell the read statement
>> that I want to use this alternate key, not the primary key to find the
>> customer info?
[snip]
>(I'm surprised Doc hasn't told you to do your own homework... :-))
I'd thought of that, Mr Dashwood... but I held off, hoping that Something
New had been invented since the Oldene Dayse, CALL 'CEEKYTP' USING
dataname or the like, where one uses a newly-invented (post-1973) bit of
jabberwocky to get a return of 'PR' or 'AL' or 'AD' or 'NK' when some
system subroutine describes the dataname as a PRimary or ALternate or
Alternate with Duplicates of Not a Key... after all, it wasn't so long ago
that someone posted code that showed how a COBOL program could access the
system clock to get microseconds and I Learned Something New.
But as for Mr Hoberg... finita la comedia, indeed. Mr Hoberg, please post
the code showing what you have tried, a sample of the data you've been
using, the results you expect and the results you have gotten; that might
allow some of the more Generous Souls here to provide a bit more
assistance.
DD
-
Re: read by which index?
In article <6mavccFftrc7U1@mid.individual.net>,
Pete Dashwood <dashwood@removethis.enternet.co.nz> wrote:
>
>
>"Paul H" <NoSpamphobergNoSpam@att.net> wrote in message
>news:4900079a$0$5468$bbae4d71@news.suddenlink.net...
>> Thanks, all of you. I have it working now. BTW, changing the file
>> structures was not an option - many programs already use them as-is.
>>
>
>Excellent! Way to go...
Whoops... so much for learning Something New... and a hearty As You Were
on that request for code-posting, as well.
DD
-
Re: read by which index?
"Pete Dashwood" <dashwood@removethis.enternet.co.nz> wrote in message
news:6mavccFftrc7U1@mid.individual.net...
> "Paul H" <NoSpamphobergNoSpam@att.net> wrote in message
> news:4900079a$0$5468$bbae4d71@news.suddenlink.net...
>> Thanks, all of you. I have it working now. BTW, changing the file
>> structures was not an option - many programs already use them as-is.
>>
> Excellent! Way to go...
Even more 'excellent' - taking the time to report to the newsgroup that one
or more of the suggestions received worked. ( Would have been better if
'which' suggestion was used were includedm but that's quibbling). Sadly,
that's a rare occurence in most online forums.
Seems to me Common Courtesy says, if asking is the "please", telling is the
"thank you."
MCM
-
Re: read by which index?
<docdwarf@panix.com> wrote in message news:gdpp1f$dv4$1@reader1.panix.com...
> In article <6mav50Fftd0jU1@mid.individual.net>,
> Pete Dashwood <dashwood@removethis.enternet.co.nz> wrote:
>>
>>
>>"William M. Klein" <wmklein@nospam.netcom.com> wrote in message
>>news:cJSLk.124904$KY3.40003@fe02.news.easynews.com...
>>> If your ACCESS Is SEQUENTIAL, then you need to use the START (with the
>>> KEY
>>> IS phrase) and then a bunch of READ NEXT statements.
>>>
>>> If your ACCESS IS DYNAMIC or RANDOM, then you should just use the READ
>>> statement and use the KEY IS phrase (as mentioned below).
>>
>>And what if the Alternate has duplicates? :-)
>
> I believe that one is notified of this by the value of the field specified
> in FILE STATUS clause, Mr Dashwood... did you know that?
Yes, Mr Dwarf I was well aware of that. :-)
Unfortunately, the contents of this field are updated AFTER access has
occurred so it doesn't help in any way to ensure that I get the specific
record (out of all the duplicates) that I actually want. The best it can do
is tell me the horse has bolted as I look at the empty barn. Did you know
that?
Using START... READ NEXT means I can actually check what record was returned
and, if it isn't the specific one I want, I can get the next one on the same
duplicate key. There is a fighting chance the required record will be
encountered if access is done this way.
> If so... do you
> know what it would be like to live in a world without hypothetical
> questions?
As that is a hyothetical question I don't need to answer it... :-)
>
> [snip]
>
>>(For DYNAMIC, you can also use
>>> the START, READ NEXT format to sequentially read via the specified key)
>>>
>>> Does this help?
>>
>>I don't know why we're even having this conversation... it's surreal :-)
>
> A fish.
Rotting from the head... :-)
Pete.
--
"I used to write COBOL...now I can do anything."
-
Re: read by which index?
In article <6mbcpoFftgouU1@mid.individual.net>,
Pete Dashwood <dashwood@removethis.enternet.co.nz> wrote:
>
>
><docdwarf@panix.com> wrote in message news:gdpp1f$dv4$1@reader1.panix.com...
>> In article <6mav50Fftd0jU1@mid.individual.net>,
>> Pete Dashwood <dashwood@removethis.enternet.co.nz> wrote:
>>>
>>>
>>>"William M. Klein" <wmklein@nospam.netcom.com> wrote in message
>>>news:cJSLk.124904$KY3.40003@fe02.news.easynews.com...
>>>> If your ACCESS Is SEQUENTIAL, then you need to use the START (with the
>>>> KEY
>>>> IS phrase) and then a bunch of READ NEXT statements.
>>>>
>>>> If your ACCESS IS DYNAMIC or RANDOM, then you should just use the READ
>>>> statement and use the KEY IS phrase (as mentioned below).
>>>
>>>And what if the Alternate has duplicates? :-)
>>
>> I believe that one is notified of this by the value of the field specified
>> in FILE STATUS clause, Mr Dashwood... did you know that?
>
>Yes, Mr Dwarf I was well aware of that. :-)
Then why bother to ask?
>Unfortunately, the contents of this field are updated AFTER access has
>occurred so it doesn't help in any way to ensure that I get the specific
>record (out of all the duplicates) that I actually want.
Mr Dashwood, you did not ask anything about getting any particular record,
you asked about 'what if the Alternate has duplicates?'. If your question
had concerned data, and how to get to them, you might have thought to ask
about those.
(for those who aren't familiar with it... there is an Olde Joke about a
fellow in a balloon asking something of someone on the ground; the oldest
version I can find uses an 'Information Technology Worker' as the grounded
one but the version I was taught had him as a Programmer. See
<http://groups.google.com/group/alt.legend.atlantis/msg/b7ea3e01773a5ba1?dmode=source>)
DD
-
Re: read by which index?
Michael Mattias wrote:
> "Pete Dashwood" <dashwood@removethis.enternet.co.nz> wrote in message
> news:6mavccFftrc7U1@mid.individual.net...
>
>>"Paul H" <NoSpamphobergNoSpam@att.net> wrote in message
>>news:4900079a$0$5468$bbae4d71@news.suddenlink.net...
>>
>>>Thanks, all of you. I have it working now. BTW, changing the file
>>>structures was not an option - many programs already use them as-is.
>>>
>>
>>Excellent! Way to go...
>
>
> Even more 'excellent' - taking the time to report to the newsgroup that one
> or more of the suggestions received worked. ( Would have been better if
> 'which' suggestion was used were includedm but that's quibbling). Sadly,
> that's a rare occurence in most online forums.
>
> Seems to me Common Courtesy says, if asking is the "please", telling is the
> "thank you."
>
> MCM
I couldn't agree more Michael. One of the reasons I'm quitting in "Last
Hurrah". With exceptions like your giving me printing table advice years
ago, I find (and I don't think I'm wrong), I give more advice than I
get. The exception - I pick a lot of good stuff up from Pete.
The sole reason I came in on this one was the OP was using M/F - so I
would be able to point him at M/F features for the future - taking it in
steps, (1) Get warmed up on Procedural COBOL, (2) RDB was a possibility
for the future with the M/F ESQL Assistant generating SQL syntax, (3)
using M/F to get into OO through dotNet.
Pete used the word 'surreal'. From the little there was of initial
information, I assumed the OP was a hobbyist getting back into COBOL.
Now I find he is on somebody's payroll. Meanwhile I earned zero last
month, the month before and zero all the way back to 2000 ! Sole income
Canada Pension and a piddly amount from UK with no cost of living index.
Now if I was a Brit retired in the States or vice versa they have a
reciprocal agreement where both countries respectively give a cost of
living index raise on pensions. Not so if you are in 'Third World'
countries like Canada, Australia, New Zealand, South Africa etc.
Have pensioners glumly accepted the status quo. No. The UK Daily
Telegraph and Winston Churchill (the old man's grandson), pleaded with
Maggie Thatcher's regime. The same pleading went on with Tony Blair's
regime. A couple of year's back a Brit retired to South Africa where her
remaining family members were now domiciled, and took up a legal
petition. Long and tediously it made its way to the House of Lords - to
the supreme judges who are members of the Lords. Result - a High Court
judge summarised, "This is a political matter. Over to you Tony".
But back to the topic - I am continuously amazed at the lack of
communication in many of the queries here. Bloody computers are all
about communication and so many just don't seem to have the skills. Pete
recently stated he has 43 years at the game. I can't help feeling it is
more because I have 45 years in IT. From my perspective 1963 - '75 - a
Systems ****yst eventually becoming Systems and Programming Manager.
(Hey Doc, I became one of your COIs :-) ). I'm still concerned that
those ****ytical skills I honed, just don't seem to be present with many
programmers - even when they have fancy titles like Systems Programmer,
Programmer ****yst and other permutations of the words.
I'm not blowing my trumpet, but I *know* I have in-built ****ytical
skills. Only some three nights ago, in his cups, my son came out with
it, complimenting me with, "And where do you think I got my skills from
?". And we are not blood related - both my boy and girl are adopted. (He
started in accounting and is now making nice lolly marketing natural gas
to the States. At one time he used to communicate with folks in the WTC
- that was until 9/11).
I didn't realize it a the time but that ****ysis thing prevailed in my
early career, even in the RAF. One thing I always remember fondly was
while with NATO in Germany, a newly arrived RAF Wing Commander overheard
me bitching to three Dutch sergeants about the lousy system used to run
a Tactical Operation Centre. Smart man - he came up to me and said, "Go
for it". I totally revamped the place so that we were all looking at one
Information Board - a bit like those boards they use for gee-gee race
tracks. A Dutch Lt. Col. complained, "It will never work...". It worked
without a single hitch next NATO exercise we had and the Dutch Colonel
took coloured photos of the set-up and took them back to his Air
Ministry in the Hague.
The significant thing about the above is that normally that would have
been done by an officer and a gentleman. It was then and probably still
is unprecedented for one of the unwashed serfs (non-comms) to even
suggest changes, let alone be given free rein to implement them.
Jimmy