View previous topic :: View next topic
|
Author |
Message |
Stephan Arenswald
New User
Joined: 08 Jul 2014 Posts: 2 Location: Germany
|
|
|
|
Hi,
I want to align the second word in a given line to a specific column in the ISPF editor.
So when I have the following
Code: |
key value
keykeykey value
keykey value
|
what I want to have is (the second word is aligned on the 19th column)
Code: |
key value
keykeykey value
keykey value
|
I'm actually searching for a sequence of line or primary commands in the ISPF editor. As an alternative I would use REXX but I'm not sure how to start with it. Furthermore, as this is a one time effort just having this sequence would be better.
But I'm open to any suggestions and help
Regards, Stephan |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Is the second value always the same, as you have shown with your sample? |
|
Back to top |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1306 Location: Vilnius, Lithuania
|
|
|
|
Start reading about bnds and the '>' line command. |
|
Back to top |
|
|
Stephan Arenswald
New User
Joined: 08 Jul 2014 Posts: 2 Location: Germany
|
|
|
|
@prino: I played around with bnds and > and it works in case the file just contains those lines. However, what I didn't show in my sample lines above I excluded some commentary lines and it seems that bnds and > doesn't support the nx flag like in c or f.
@Bill Woodger: Nope, they are not the same
Here is a better example of my input file. I excluded all the comment file using x.
Code: |
key value1
* some comment comment comment *
keykeykey value2
keykey value3
|
|
|
Back to top |
|
|
Paul Voyner
New User
Joined: 26 Nov 2012 Posts: 52 Location: UK
|
|
|
|
Stephan, based on your example, try:
- Set right-hand boundary with BNDS
- X to exclude comments
- C ' ' ' ' all nx (note this is changing 1 blank to 2 blanks)
- Retrieve and reenter the C command until everything aligned
Or put the above in a simple edit macro |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Nice thought. You can get the C(hange) command to stay on the command line (usually prefix with &), and just press enter until the alignment stops. |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
|
|
You learn something every day. I did not know the '&' worked in the ISPF editor. |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
|
|
Quote: |
- Set right-hand boundary with BNDS |
I tried the process described but the sample text, 'value1', stops shifting right too early. It stops when the rightmost text reaches the boundary.
Code: |
=BNDS> < >
==ERR> key value1
- - - - - - - - - - - - - - -
==ERR> keykeykey value2
==ERR> keykey value3 |
I suppose I can just move the right boundary if all of 'value1', 'value2', and 'value3' are the same length. But if the lengths are different, it will not work correctly.
The results are better if you do not use BNDS at all but instead set the boundary within the change command itself:
Code: |
&C ' ' ' ' all nx 1 25 |
|
|
Back to top |
|
|
Paul Voyner
New User
Joined: 26 Nov 2012 Posts: 52 Location: UK
|
|
|
|
@Pedro, I guess it depends if he wants the "value" column right- or left-aligned. What you suggest is the one to use for left-aligned (and you don't get ==ERR messages) |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
|
|
From the original post:
Quote: |
what I want to have is (the second word is aligned on the 19th column) |
|
|
Back to top |
|
|
|