HP3000-L Archives

May 2005, Week 3

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
"Newton, Ernie" <[log in to unmask]>
Reply To:
Newton, Ernie
Date:
Wed, 18 May 2005 13:12:03 -0700
Content-Type:
text/plain
Parts/Attachments:
text/plain (141 lines)
Ohhhhhhh of course.

I can put a new counter that gets incremented AFTER 
I do a MOVE, then move the byte to that location.

This is what happens when you only do ad-hoc programming
3 or 4 times a year.

I will concede that it was horribly illogical...

Thanks for your help.
I love this list...

ernie

-----Original Message-----
From: Dave Oksner [mailto:[log in to unmask]] 
Sent: Wednesday, May 18, 2005 12:53 PM
To: [log in to unmask]
Subject: Re: [HP3000-L] COBOL question


Well, no matter how convoluted, the problem is still the fact that
you're relying on only one counter (well, I guess there are two, but one
of them is set by the other).  You need separate counters for the input
and output string.  Otherwise, you're just moving the letters into the
same position in the new string.

Dave

On Wed, May 18, 2005 at 12:45:47PM -0700, Newton, Ernie wrote:
> It might by convoluted, but HORRIBLY convoluted?
> Now my feelings are hurt.
>
> Actually I need to clarify.  I am concatenating a series
> of comments into one text line and I want to get rid
> of EXTRA spaces.  I only want ONE space between words.
>
> Thanks for your input.
>
> Ernie
>
>
> -----Original Message-----
> From: Shawn Gordon [mailto:[log in to unmask]]
> Sent: Wednesday, May 18, 2005 12:11 PM
> To: [log in to unmask]
> Subject: Re: [HP3000-L] COBOL question
>
>
> well as a matter of form I'd put that in an inline PERFORM instead of 
> branching to another paragraph, but your objective isn't clear, it 
> looks like you are only moving characters if you have two spaces in a 
> row, which could be indicated much easier by just saying 
> COMMENT-BUFFER(DL-COUNTER
> -1:2) or just setting DL-COUNTER to 1 to start instead of 2 and you 
> wouldn't need the -1.  Basically this is a horribly convoluted way to 
> do this and you are using the same pointer for the source and 
> destination string which isn't right since you are taking spaces out 
> the destination pointer will be smaller.  If you want to get the 
> fields out delimited by space then just use UNSTRING, but if you want 
> to remove each space then something like the following should work 
> fine:
>
> MOVE 0 TO NEW-COUNTER
> PERFORM VARYING DL-COUNTER FROM 1 BY 1 UNTIL DL-COUNTER > 186
>     IF COMMENT-BUFFER(DL-COUNTER:1) <> SPACE
>        ADD 1 TO NEW COUNTER
>        MOVE COMMENT-BUFFER(DL-COUNTER:1) TO DL-COMMENTS(NEW-COUNTER:1)
>     END-IF
> END-PERFORM.
>
> At 11:31 AM 5/18/2005, Newton, Ernie wrote:
> >Greetings,
> >
> >I'm trying to take spaces out of the middle of a string.
> >
> >I cannot see the error in my logic.
> >
> >Here's what I'm doing...
> >
> >*************************************************
> >
> >PERFORM 2005-SQUISH-COMMENTS
> >     VARYING DL-COUNTER FROM 2
> >         BY 1 UNTIL DL-COUNTER > 186
> >
> >2005-SQUISH-COMMENTS.
> >     COMPUTE LESS-1-COUNTER = DL-COUNTER - 1.
> >     IF COMMENT-BUFFER(LESS-1-COUNTER : 1) = SPACE
> >         AND COMMENT-BUFFER(DL-COUNTER : 1) = SPACE
> >             NEXT SENTENCE
> >     ELSE
> >         MOVE COMMENT-BUFFER(DL-COUNTER : 1)
> >           TO DL-COMMENTS(DL-COUNTER : 1)
> >
> >**************************************************
> >
> >DL-COMMENTS should be clean of extra spaces....shouldn't it?
> >
> >Is there an easier way using the STRING statement?
> >
> >Thanks,
> >
> >Ernie
> >
> >* To join/leave the list, search archives, change list settings, *
> >* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
>
>
> Regards,
>
> Shawn Gordon
> President
> theKompany.com
> www.thekompany.com
> www.mindawn.com
> 949-713-3276
>
> * To join/leave the list, search archives, change list settings, *
> * etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
>
> * To join/leave the list, search archives, change list settings, *
> * etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

--
+---------------David Oksner-----http://www.case.net/----------------+
|Rules for driving in New York:                                      |
|        (1) Anything done while honking your horn is legal.         |
|        (2) You may park anywhere if you turn your four-way flashers|
|            on.                                                     |
|        (3) A red light means the next six cars may go through the  |
|            intersection.                                           |
[log in to unmask]

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

ATOM RSS1 RSS2