View previous topic :: View next topic |
Author |
Message |
cyberuser Beginner
Joined: 15 Oct 2005 Posts: 29 Topics: 12
|
Posted: Sat Jul 04, 2015 1:19 pm Post subject: Removing end pipe from end of line |
|
|
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 |
|
|
t-bonham@scc.net Supermod
Joined: 18 Oct 2012 Posts: 30 Topics: 0 Location: Minneapolis, MN
|
Posted: Sat Jul 04, 2015 5:04 pm Post subject: |
|
|
Not sure about Rexx, but in batch ISPF Edit, do this:
Code: | CHANGE "|' " "' " ALL |
|
|
Back to top |
|
|
semigeezer Supermod
Joined: 03 Jan 2003 Posts: 1014 Topics: 13 Location: Atlantis
|
Posted: Sat Jul 04, 2015 6:47 pm Post subject: |
|
|
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 |
|
|
Nic Clouston Advanced
Joined: 01 Feb 2007 Posts: 1075 Topics: 7 Location: At Home
|
Posted: Mon Jul 06, 2015 11:40 am Post subject: |
|
|
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 |
|
|
misi01 Advanced
Joined: 02 Dec 2002 Posts: 629 Topics: 176 Location: Stockholm, Sweden
|
Posted: Sun Aug 16, 2015 1:37 am Post subject: Not at work to test, but wouldn't the following work |
|
|
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 |
|
|
|
|