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 

Removing end pipe from end of line

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF
View previous topic :: View next topic  
Author Message
cyberuser
Beginner


Joined: 15 Oct 2005
Posts: 29
Topics: 12

PostPosted: Sat Jul 04, 2015 1:19 pm    Post subject: Removing end pipe from end of line Reply with quote

I'm trying to achieve the following in REXX but i think i'm getting too old for this.
Any help is appreciated.

Code:
Sample Data
'data|data|data|data|'       ;
'data|data|data||'            ;
'data|data|||'            ;
'data||||'            ;



Code:
Desire result would be :
'data|data|data|data'       ;
'data|data|data'            ;
'data|data'            ;
'data'            ;


Up to 4 DATAs
DATA may vary its length from 1 to 8.
; varies the position but can be aligned to the end of the line
' needs to remain at the beginning and after the last DATA.
Exceeding | needs to be removed.
Back to top
View user's profile Send private message
t-bonham@scc.net
Supermod


Joined: 18 Oct 2012
Posts: 30
Topics: 0
Location: Minneapolis, MN

PostPosted: Sat Jul 04, 2015 5:04 pm    Post subject: Reply with quote

Not sure about Rexx, but in batch ISPF Edit, do this:
Code:
CHANGE "|' "  "'  " ALL
Back to top
View user's profile Send private message Send e-mail AIM Address
semigeezer
Supermod


Joined: 03 Jan 2003
Posts: 1014
Topics: 13
Location: Atlantis

PostPosted: Sat Jul 04, 2015 6:47 pm    Post subject: Reply with quote

one [maybe not too efficient] way, but it assumes data elements of just spaces will not be present in the last position...
Code:
c = "'data|data|data|data|||'   ;"
Do While 0 < pos("|'",c);
  Parse value reverse(c) With a "|" d
  c = reverse(a || d)
End
Say c
This is the 1st time I've thought about any code that might run on a mainframe in well over a year. Obviously this wasn't tested on one.
Back to top
View user's profile Send private message Visit poster's website
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Mon Jul 06, 2015 11:40 am    Post subject: Reply with quote

This shoulod give you the information that you need to get you to where you want
Code:
                                    Rexx Try
                                    --------

Enter 'U' to see the user guide.

Enter a Rexx statement at the prompt or a RexxTry command:
                A, C, F, I, U or X

Rexx > c = "'data|data||'"
Rexx > x = pos("|'",c)
Rexx > say x
12
Rexx > d = Substr(c,1,x-1)||"'"
Rexx > say d
'data|data|'

put into a loop until x is 0

_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
misi01
Advanced


Joined: 02 Dec 2002
Posts: 616
Topics: 171
Location: Stockholm, Sweden

PostPosted: Sun Aug 16, 2015 1:37 am    Post subject: Not at work to test, but wouldn't the following work Reply with quote

Code:
X = next_line_in_file
X = reverse(x)
X = strip(x)
Y = verify(|)
Stripped_line = reverse(substr(x,y))


Repeat for all lines
_________________
Michael
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF 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