Re: Trying to use STRING
- From: docdwarf@xxxxxxxxx ()
- Date: Wed, 14 Mar 2007 14:33:14 +0000 (UTC)
In article <1173881236.224187.243780@xxxxxxxxxxxxxxxxxxxxxxxxxxx>,
razor <iruddock@xxxxxxxxxxxxxxxx> wrote:
Sorry, should have added I am using MF Netexpress 3.1.
Why do these request for help result in people trying to 'outcode'
each other?
I'm not sure if that is what is happening, Mr Ruddock, or whether it is
'this is what comes to my mind'; you asked for help with code and coders
offered help... and code.
[snip]
I don't like having to rely on two (or more) spaces as this is a fudge
and will come back to haunt a future COBOL trainee given his first
debugging task.
It is best, I've found, to make as few assumptions about data as possible;
'it will be terminated by two spaces and never, *ever*, contain two
embedded spaces' is more reliant on purity than I like to be. As my first
programming instructor asked the class:
'What is the definition of a 'computer user'?
(pause for responses, each met with a curt 'No')
'A 'computer user' is someone who, when prompted to supply a 'Y' or 'N'
response, will key in the numeral '8'. Write *all* of your online
applications with this in mind and your users will love you.'
Life may not be that simple, no... but I've found it a good rule to
remember.
I had already thought about reading backwards through each string and
using 'Reference modification' to effectively trim each field.
Great minds running in similar and small circles, perhaps.
Thanks DD for your help. Sorry, but your assumptions about 77's was
incorrect. I have never used mainframe so never had to worry about
word alignment and now just don't care whether I use 77 or 01 levels.
Yes, I'm 'out there crazy' aren't I.
Not in the least... I heard hoofbeats and I concluded 'horses'; this week
it was zebras... I'll survive the stampede, somehow.
So my solution will have to be as I had originally thought, but very
inelegant.
77 WS-NAME PIC X(30).
77 WS-ADD1 PIC X(30).
77 WS-BALANCE PIC ZZZZZ9.99.
77 WS-STRING PIC X(60).
77 WS-STRING-LENGTH PIC 99.
77 WS-NAME-LENGTH PIC 99.
77 WS-ADD1-LENGTH PIC 99.
MOVE WS-NAME TO WS-STRING PERFORM GET-LENGTH-OF-STRING MOVE WS-STRING-
LENGTH TO WS-NAME-LENGTH.
Once it is cleaned up I'd say the mechanism (use of common area and code)
is one I've seen before; as a matter of style I'd prefer doing it all 'in
place' as my given example indicated.
If you have access to someone who can be used as the 'future COBOL
trainee' you mention being concerned about - a more common use, in my
experience, is 'a two-year programmer' - you might want to present both
styles and see what the response is.
[snip]
Thanks to all, as its my first request for help, standby for
more....:-)
For a first request it seemed remarkably well-formed, with examples of
data, what you want and (most importantly, to some) what you've tried
already.
DD
.
- References:
- Trying to use STRING
- From: razor
- Re: Trying to use STRING
- From: Roger While
- Re: Trying to use STRING
- From:
- Re: Trying to use STRING
- From: razor
- Trying to use STRING
- Prev by Date: Re: Trying to use STRING
- Next by Date: Re: Trying to use STRING
- Previous by thread: Re: Trying to use STRING
- Next by thread: Re: Trying to use STRING
- Index(es):
Relevant Pages
|