MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Remove trailing spaces from a variable in Cobol

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
gpaulose
Beginner


Joined: 04 Sep 2007
Posts: 10
Topics: 4

PostPosted: Wed Jan 16, 2008 12:05 pm    Post subject: Remove trailing spaces from a variable in Cobol Reply with quote

I need to remove trailing spaces from a variable in Cobol. Please suggest the easiest way of doing it.
Back to top
View user's profile Send private message
CraigG
Intermediate


Joined: 02 May 2007
Posts: 202
Topics: 0
Location: Viginia, USA

PostPosted: Wed Jan 16, 2008 12:31 pm    Post subject: Re: Remove trailing spaces from a variable in Cobol Reply with quote

gpaulose wrote:
I need to remove trailing spaces from a variable in Cobol. Please suggest the easiest way of doing it.


What are you going to replace them with?
Back to top
View user's profile Send private message
NASCAR9
Intermediate


Joined: 08 Oct 2004
Posts: 274
Topics: 52
Location: California

PostPosted: Wed Jan 16, 2008 12:42 pm    Post subject: Reply with quote

Code:
 
01  W-TEXT               PIC  X(40) VALUE 'NAREN HAD PROBLEM'.
 01  W-TALLY              PIC S9(04) COMP VALUE ZERO.           
 01  W-STR-LENGTH         PIC  9(03) VALUE ZERO.               
                                                               
 PROCEDURE DIVISION.                                           
                                                               
    MOVE ZEROES                  TO W-TALLY                     
                                                W-STR-LENGTH.               
                                                                     
    INSPECT FUNCTION REVERSE(W-TEXT) TALLYING W-TALLY           
          FOR LEADING SPACES                                   
                                                               
    COMPUTE W-STR-LENGTH = LENGTH OF W-TEXT -  W-TALLY         
                                                               
    DISPLAY 'THE STRING LENGTH IS:' W-STR-LENGTH   
    MOVE W_TEXT (1:W-STR-LENGTH) TO    ??????   

   

_________________
Thanks,
NASCAR9
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group