IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

removing leading spaces when moving a variable


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
briansheehan

New User


Joined: 02 Jun 2007
Posts: 5
Location: ireland

PostPosted: Thu Sep 13, 2007 8:05 pm
Reply with quote

I have two variables, both PIC X (120).

For illustration sake Variable A is ' abcdef......'

I want to move Variable A into Variable B, but have the leading spaces removed, so it reads 'abcdef.......'.

thanks
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Thu Sep 13, 2007 8:21 pm
Reply with quote

Variable number of leading spaces?
Pad with spaces in the rear?
Back to top
View user's profile Send private message
briansheehan

New User


Joined: 02 Jun 2007
Posts: 5
Location: ireland

PostPosted: Thu Sep 13, 2007 8:26 pm
Reply with quote

yes, a variable number of leading spaces.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Thu Sep 13, 2007 8:28 pm
Reply with quote

Inplace:
Code:
perform varying I from 1 by 1 until E(1:1) not = space
   if E(I:1) = space
      continue
   else
      move E(I:) to E(1:)
   end-if
end-perform

To a different dataarea:
Code:
perform varying I from 1 by 1 until E(1:1) not = space
   if E(I:1) = space
      continue
   else
      move E(I:) to F
   end-if
end-perform
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Keep leading zero(s) after convert fl... SYNCSORT 7
No new posts Remove leading zeroes SYNCSORT 4
No new posts leading spaces can be removed in trai... DFSORT/ICETOOL 1
No new posts Variable Output file name DFSORT/ICETOOL 8
Search our Forums:

Back to Top