HP3000-L Archives

October 2002, 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:
"Schlosser, Robert J" <[log in to unmask]>
Reply To:
Schlosser, Robert J
Date:
Sat, 19 Oct 2002 07:47:59 -0500
Content-Type:
text/plain
Parts/Attachments:
text/plain (56 lines)
Raghu

        With the FUNCTIONS available when the POST85 compiler directive is invoked you can do the following:

        MOVE FUNCTION REVERSE (WS-FIRSTNAME) TO WS-FIRSTNAME.
        INSPECT WS-FIRSTNAME TALLYING SPACE-COUNT FOR LEADING SPACES.
        MOVE FUNCTION REVERSE (WS-FIRSTNAME) TO WS-FIRSTNAME.
        SUBTRACT SPACE-COUNT FROM {len of ws-firstname) GIVING FN-LEN.
        MOVE FUNCTION REVERSE (WS-LASTNAME) TO WS-LASTNAME.
        INSPECT WS-LASTNAME TALLYING SPACE-COUNT FOR LEADING SPACES.
        MOVE FUNCTION REVERSE (WS-LASTNAME) TO WS-LASTNAME.
        SUBTRACT SPACE-COUNT FROM {len of ws-lastname) GIVING LN-LEN.
        MOVE SPACES TO DISPLAY-NAME.
        MOVE WS-FIRSTNAME (1:FN-LEN) TO DISPLAY-NAME.
        ADD 1 TI FN-LEN.
        MOVE WS-LASTNAME (1:LN-LEN) TO DISPLAY-NAME(FN-LEN:LN-LEN).


        For those special cases, a space in the first name field should give you the starting point
        to parse them out and move them to the correct places.

Robert Schlosser _ MPE-CSM
Ochsner Health Plan
(504) 219-8134 

-----Original Message-----
From: Rao, Raghu [mailto:[log in to unmask]]
Sent: Friday, October 18, 2002 6:12 PM
To: [log in to unmask]
Subject: COBOL : Removing trailing spaces ?


Hi all,

I am having 2 fields WS-FIRSTNAME and WS-LASTNAME. The data in them contains
"JOE              " and "SMITH               "

How do I get my final output to be "JOE SMITH" ?

Any suggestions through INSPECT or EXAMINE or REPLACE SPACES BY NULLS, etc ?
? ? I don't want to use any loop to search each and every field position for
spaces or anything like that..

The data in these 2 fields is left justified but can contain any names and
may not always look like the example provided above. It can also contain
special names like "JOE SR.          " or JOE III           "

Thanks
Raghu.

* 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