From: Anonymous on
In article <325a0e42-79d2-4e47-90f7-0c0a37ef7794(a)b30g2000yqd.googlegroups.com>,
jmoore <jmoore207(a)gmail.com> wrote:
>On Mar 26, 12:07?pm, jmoore <jmoore...(a)gmail.com> wrote:
>> On Mar 26, 10:58?am, docdw...(a)panix.com () wrote:
>>
>> > In article
><110d3882-2c6c-4a32-9412-7f5766712...(a)g11g2000yqe.googlegroups.com>,
>>
>> > jmoore ?<jmoore...(a)gmail.com> wrote:
>> > >I am not familiar with the funtion reverse command.
>>
>> > That's one of the things manuals can be good at doing, providing
>> > familiarity. ?You might want to check
>> > <http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/igy3lr10/7...>
>>
>> Thank ya doc!
>
>To accomplish what I posted should I just use a perform varying
>backwards?

What you posted seems to be an example of 'mailing list address
processing', a dark, twisted and arcane art. Those skilled in the
practise of it are usually compensated at well-above-market rates; you
seem to be asking them for Free Work and I don't know many who'd respond
in a fashion suitable for quoting in mixed company.

DD

From: jmoore on
On Mar 26, 12:20 pm, docdw...(a)panix.com () wrote:
> In article <325a0e42-79d2-4e47-90f7-0c0a37ef7...(a)b30g2000yqd.googlegroups..com>,
>
>
>
>
>
> jmoore  <jmoore...(a)gmail.com> wrote:
> >On Mar 26, 12:07?pm, jmoore <jmoore...(a)gmail.com> wrote:
> >> On Mar 26, 10:58?am, docdw...(a)panix.com () wrote:
>
> >> > In article
> ><110d3882-2c6c-4a32-9412-7f5766712...(a)g11g2000yqe.googlegroups.com>,
>
> >> > jmoore ?<jmoore...(a)gmail.com> wrote:
> >> > >I am not familiar with the funtion reverse command.
>
> >> > That's one of the things manuals can be good at doing, providing
> >> > familiarity. ?You might want to check
> >> > <http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/igy3lr10/7...>
>
> >> Thank ya doc!
>
> >To accomplish what I posted should I just use a perform varying
> >backwards?
>
> What you posted seems to be an example of 'mailing list address
> processing', a dark, twisted and arcane art.  Those skilled in the
> practise of it are usually compensated at well-above-market rates; you
> seem to be asking them for Free Work and I don't know many who'd respond
> in a fashion suitable for quoting in mixed company.
>
> DD- Hide quoted text -
>
> - Show quoted text -

No problem. I wasn't aware of these "artists". I am sure I can figure
it out. Thanks for the link.
From: Pete Dashwood on
jmoore wrote:
> I am not familiar with the funtion reverse command. Does it reverse 2
> fields or just the field? ie.
> SANDY = YDNAS. I am looking to change some addresses that come intro
> the file as 123 Maint St and change them to Main St 123.

If I were you, I wouldn't use function reversed for this.

Consider the following:

01 address-array.
12 address-words occurs <whatever, lets say 5 for this
example...>
indexed by aw-x1.
15 aword pic x(30) *> adjust this to be whatever your data
shows as a reaonable size for a street or town name. 30 works for NZ.

....

unstring input-buffer
delimited by space
into
aword (1)
aword (2)
aword (3)
aword (4)
aword (5)
end-unstring

Note that, while this seems pretty useful, it may result in a stochastic or
sparse array. (There can be blank entries). If the input string had 2 (or
more) spaces between '123' and 'Main', for example, aword (2) would be blank
and so would each following aword for the number of spaces encountered in
the input. (It is usual to avoid this by doing some preparation with removel
of superfluous spaces from the input buffer before unstringing it.).

Given that God's on your side (or you did some preparation) and the address
words are separated by single spaces, you will get each word loaded into the
array.

In your example '123 Main st.', aword ( 1) through aword (3) will be
"filled" and the rest empty, it isn't too hard to swap the words you want
swapped...

It is also useful to have a facility that moves everything up one entry (you
can do this with a perform varying loop, or with a single refmodded
statement - I prefer the refmodding because it is quicker and more elegant
but I have met people who don't understand it and find it confusing, so the
perform loop is a simpler option. Mind you, I have also worked on sites
where they wouldn't allow perform..varying... because it was "too complex";
some so-called "computer programmers" should really be doing something
else...)

Having loaded your words and manipulated them in the address array, you now
need to put them back

move spaces to out-buffer
perform
varying aw-x1
from 1
by 1
until aw-x1 > 5 *> if you are sure you have removed
blank entries through manipulation you could control this by testing for a
blank entry as being the end...
if aword (aw-x1) NOT = space
string
out-buffer
delimited by space
space
delimited by size
aword (aw-x1)
delimited by space
into out-buffer
end-string
end-if
end-perform

The result in out-buffer will be:

' Main St. 123'... which isn't EXACTLY what you want... remove the leading
space with...

move out-buffer (2: <defined length of out-buffer, or function
length if you have it> - 1) to out buffer

NOW you have 'Main St. 123'

There are pros and cons in everything and things can look strange if you
haven't seen them before. I like manipulating words rather than characters,
if I'm dealing with text like address formats. Obviously, not the ONLY way,
but this is the way I prefer.

If you want to see COBOL being used to process addresses, try this URL:

http://primacomputing.co.nz/PRIMAWebSite/default.aspx ... and click on the
little postman icon. Try cutting some of the examples and pasting them into
the pane. These are "free format" addresses; no fixed street, town,
postcode, or any other fields, separated by any number of spaces, and the
COBOL engine sorts it all out, using heuristics and some smart programming.
You will probably realize that the input to this engine is a free format
buffer containing words that MIGHT constitute a valid NZ address, separated
by any number of spaces. Guess how it sorts it out? :-)

This is running as a Web Service on my web server in Florida. When you hit
enter, the message travels from your desktop to Florida, gets parsed and
analysed, accesses a number of tables on 3 relational databases, results are
re-assembled for delivery and pushed back to your desktop. The first address
you try may take a few seconds while things get initialized and buffers get
loaded, after that... well, see for yourself :-).

Enjoy!

Pete.

--
"I used to write COBOL...now I can do anything."


From: Richard on
On Mar 27, 1:52 pm, "Pete Dashwood"
<dashw...(a)removethis.enternet.co.nz> wrote:
> jmoore wrote:
> > I am not familiar with the funtion reverse command. Does it reverse 2
> > fields or just the field? ie.
> > SANDY = YDNAS.  I am looking to change some addresses that come intro
> > the file as 123 Maint St and change them to Main St 123.
>
> If I were you, I wouldn't use function reversed for this.
>
> Consider the following:
>
> 01    address-array.
>         12 address-words   occurs  <whatever, lets say 5 for this
> example...>
>                                        indexed by aw-x1.
>              15 aword   pic x(30) *> adjust this to be whatever your data
> shows as a reaonable size for a street or town name. 30 works for NZ.
>
> ...
>
>           unstring input-buffer
>                delimited by space
>                    into
>                          aword (1)
>                          aword (2)
>                          aword (3)
>                          aword (4)
>                          aword (5)
>           end-unstring
>
> Note that, while this seems pretty useful, it may result in a stochastic or
> sparse array. (There can be blank entries). If the input string had 2 (or
> more) spaces between '123' and 'Main', for example, aword (2) would be blank
> and so would each following aword for the number of spaces encountered in
> the input. (It is usual to avoid this by doing some preparation with removel
> of superfluous spaces from the input buffer before unstringing it.).
>

Actually a better way is 'delimited by all spaces' then there are no
blank fields except the trailing ones and no need to 'remove
superfluous spaces first'.

It would also be useful to add COUNT IN awordsize(n) for each because,
it seems to me, the numeric field is to be identified and this could
be done with:

IF aword(n)(1:awordsize(n)) IS NUMERIC

However I don't know if one would get '123A Main St.' as is found
here. Or '123/4 Main St.' or 'Flat 4 123 Main St.'


> Given that God's on your side (or you did some preparation) and the address
> words are separated by single spaces, you will get each word loaded into the
> array.

Or possibly that you have a better knowledge of COBOL.


> In your example '123 Main st.',  aword ( 1) through aword (3) will be
> "filled" and the rest empty, it isn't too hard to swap the words you want
> swapped...
>
> It is also useful to have a facility that moves everything up one entry (you
> can do this with a perform varying loop, or with a single refmodded
> statement - I prefer the refmodding because it is quicker and more elegant
> but I have met people who don't understand it and find it confusing, so the
> perform loop is a simpler option. Mind you, I have also worked on sites
> where they wouldn't allow perform..varying... because it was "too complex";
> some so-called "computer programmers" should really be doing something
> else...)
>
> Having loaded your words and manipulated them in the address array, you now
> need to put them back
>
>              move spaces to out-buffer
>              perform
>                  varying   aw-x1
>                      from   1
>                         by   1
>                       until   aw-x1 > 5 *> if you are sure you have removed
> blank entries through manipulation you could control this by testing for a
> blank entry as being the end...
>                       if  aword (aw-x1) NOT = space
>                           string
>                                  out-buffer
>                                         delimited by space
>                                  space
>                                          delimited by size
>                                  aword (aw-x1)
>                                         delimited by space
>                                               into out-buffer
>                           end-string
>                      end-if
>              end-perform
>
> The result in out-buffer will be:
>
> ' Main St. 123'... which isn't EXACTLY what you want...  remove the leading
> space with...
>
>               move out-buffer (2: <defined length of out-buffer, or function
> length if you have it> - 1) to out buffer
>
> NOW you have 'Main St. 123'
>
> There are pros and cons in everything and things can look strange if you
> haven't seen them before. I like manipulating words rather than characters,
> if I'm dealing with text like address formats. Obviously, not the ONLY way,
> but this is the way I prefer.
>
> If you want to see COBOL being used to process addresses, try this URL:
>
> http://primacomputing.co.nz/PRIMAWebSite/default.aspx  ... and click on the
> little postman icon. Try cutting some of the examples and pasting them into
> the pane. These are "free format" addresses; no fixed street, town,
> postcode, or any other fields, separated by any number of spaces, and the
> COBOL engine sorts it all out, using heuristics and some smart programming.
> You will probably realize that the input to this engine is a free format
> buffer containing words that MIGHT constitute a valid NZ address, separated
> by any number of spaces. Guess how it sorts it out? :-)
>
> This is running as a Web Service on my web server in Florida. When you hit
> enter, the message travels from your desktop to Florida, gets parsed and
> analysed, accesses a number of tables on 3 relational databases, results are
> re-assembled for delivery and pushed back to your desktop. The first address
> you try may take a few seconds while things get initialized and buffers get
> loaded, after that... well, see for yourself :-).
>
> Enjoy!
>
> Pete.
>
> --
> "I used to write COBOL...now I can do anything."

From: Pete Dashwood on
Richard wrote:
> On Mar 27, 1:52 pm, "Pete Dashwood"
> <dashw...(a)removethis.enternet.co.nz> wrote:
>> jmoore wrote:
>>> I am not familiar with the funtion reverse command. Does it reverse
>>> 2 fields or just the field? ie.
>>> SANDY = YDNAS. I am looking to change some addresses that come intro
>>> the file as 123 Maint St and change them to Main St 123.
>>
>> If I were you, I wouldn't use function reversed for this.
>>
>> Consider the following:
>>
>> 01 address-array.
>> 12 address-words occurs <whatever, lets say 5 for this
>> example...>
>> indexed by aw-x1.
>> 15 aword pic x(30) *> adjust this to be whatever your data
>> shows as a reaonable size for a street or town name. 30 works for NZ.
>>
>> ...
>>
>> unstring input-buffer
>> delimited by space
>> into
>> aword (1)
>> aword (2)
>> aword (3)
>> aword (4)
>> aword (5)
>> end-unstring
>>
>> Note that, while this seems pretty useful, it may result in a
>> stochastic or sparse array. (There can be blank entries). If the
>> input string had 2 (or more) spaces between '123' and 'Main', for
>> example, aword (2) would be blank and so would each following aword
>> for the number of spaces encountered in the input. (It is usual to
>> avoid this by doing some preparation with removel of superfluous
>> spaces from the input buffer before unstringing it.).
>>
>
> Actually a better way is 'delimited by all spaces' then there are no
> blank fields except the trailing ones and no need to 'remove
> superfluous spaces first'.

That's a good point, Richard. I understood that ALL spaces worked for the
trailing spaces. I didn't know it would work for each word if there was more
than one space. Thanks.

>
> It would also be useful to add COUNT IN awordsize(n) for each because,
> it seems to me, the numeric field is to be identified and this could
> be done with:
>
> IF aword(n)(1:awordsize(n)) IS NUMERIC

I have used COUNT for variable stringing and unstringing and found it
useful. I didn't mention it here because i was tryin gto keep it to the
basic concepts.
>
> However I don't know if one would get '123A Main St.' as is found
> here. Or '123/4 Main St.' or 'Flat 4 123 Main St.'
>
>
>> Given that God's on your side (or you did some preparation) and the
>> address words are separated by single spaces, you will get each word
>> loaded into the array.
>
> Or possibly that you have a better knowledge of COBOL.
>
>
>> In your example '123 Main st.', aword ( 1) through aword (3) will be
>> "filled" and the rest empty, it isn't too hard to swap the words you
>> want swapped...
>>
>> It is also useful to have a facility that moves everything up one
>> entry (you can do this with a perform varying loop, or with a single
>> refmodded statement - I prefer the refmodding because it is quicker
>> and more elegant but I have met people who don't understand it and
>> find it confusing, so the perform loop is a simpler option. Mind
>> you, I have also worked on sites where they wouldn't allow
>> perform..varying... because it was "too complex"; some so-called
>> "computer programmers" should really be doing something else...)
>>
>> Having loaded your words and manipulated them in the address array,
>> you now need to put them back
>>
>> move spaces to out-buffer
>> perform
>> varying aw-x1
>> from 1
>> by 1
>> until aw-x1 > 5 *> if you are sure you have removed
>> blank entries through manipulation you could control this by testing
>> for a blank entry as being the end...
>> if aword (aw-x1) NOT = space
>> string
>> out-buffer
>> delimited by space
>> space
>> delimited by size
>> aword (aw-x1)
>> delimited by space
>> into out-buffer
>> end-string
>> end-if
>> end-perform
>>
>> The result in out-buffer will be:
>>
>> ' Main St. 123'... which isn't EXACTLY what you want... remove the
>> leading space with...
>>
>> move out-buffer (2: <defined length of out-buffer, or function
>> length if you have it> - 1) to out buffer
>>
>> NOW you have 'Main St. 123'
>>
>> There are pros and cons in everything and things can look strange if
>> you haven't seen them before. I like manipulating words rather than
>> characters, if I'm dealing with text like address formats.
>> Obviously, not the ONLY way, but this is the way I prefer.
>>
>> If you want to see COBOL being used to process addresses, try this
>> URL:
>>
>> http://primacomputing.co.nz/PRIMAWebSite/default.aspx ... and click
>> on the little postman icon. Try cutting some of the examples and
>> pasting them into the pane. These are "free format" addresses; no
>> fixed street, town, postcode, or any other fields, separated by any
>> number of spaces, and the COBOL engine sorts it all out, using
>> heuristics and some smart programming. You will probably realize
>> that the input to this engine is a free format buffer containing
>> words that MIGHT constitute a valid NZ address, separated by any
>> number of spaces. Guess how it sorts it out? :-)
>>
>> This is running as a Web Service on my web server in Florida. When
>> you hit enter, the message travels from your desktop to Florida,
>> gets parsed and analysed, accesses a number of tables on 3
>> relational databases, results are re-assembled for delivery and
>> pushed back to your desktop. The first address you try may take a
>> few seconds while things get initialized and buffers get loaded,
>> after that... well, see for yourself :-).
>>
>> Enjoy!
>>
>> Pete.
>>
>> --
>> "I used to write COBOL...now I can do anything."

--
"I used to write COBOL...now I can do anything."