Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

removing leading spaces when moving a variable

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: removing leading spaces when moving a variable
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: 2150
Location: At my coffee table

PostPosted: Thu Sep 13, 2007 8:21 pm    Post subject:
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    Post subject: Reply to: removing leading spaces when moving a variable
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: 2150
Location: At my coffee table

PostPosted: Thu Sep 13, 2007 8:28 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts To trim spaces in a pipe delimited da... Nish84 COBOL Programming 16 Mon Oct 10, 2016 1:54 pm
No new posts Moving a PD to PD spoorni DFSORT/ICETOOL 8 Fri Oct 07, 2016 9:52 pm
No new posts Format to pipe delimited with variabl... pshongal SYNCSORT 6 Wed Sep 14, 2016 2:48 pm
No new posts Removing Extra Spaces in a comma sepa... Puspojit DFSORT/ICETOOL 3 Tue Sep 13, 2016 7:46 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us