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

Align second word to specific column


IBM Mainframe Forums -> TSO/ISPF
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Stephan Arenswald

New User


Joined: 08 Jul 2014
Posts: 2
Location: Germany

PostPosted: Tue Jul 08, 2014 12:00 pm
Reply with quote

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 icon_smile.gif

Regards, Stephan
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Jul 08, 2014 12:15 pm
Reply with quote

Is the second value always the same, as you have shown with your sample?
Back to top
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1306
Location: Vilnius, Lithuania

PostPosted: Tue Jul 08, 2014 12:15 pm
Reply with quote

Start reading about bnds and the '>' line command.
Back to top
View user's profile Send private message
Stephan Arenswald

New User


Joined: 08 Jul 2014
Posts: 2
Location: Germany

PostPosted: Tue Jul 08, 2014 6:35 pm
Reply with quote

@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
View user's profile Send private message
Paul Voyner

New User


Joined: 26 Nov 2012
Posts: 52
Location: UK

PostPosted: Wed Jul 09, 2014 12:44 pm
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Jul 09, 2014 12:55 pm
Reply with quote

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
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2547
Location: Silicon Valley

PostPosted: Wed Jul 09, 2014 10:59 pm
Reply with quote

You learn something every day. I did not know the '&' worked in the ISPF editor.
Back to top
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2547
Location: Silicon Valley

PostPosted: Wed Jul 09, 2014 11:22 pm
Reply with quote

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
View user's profile Send private message
Paul Voyner

New User


Joined: 26 Nov 2012
Posts: 52
Location: UK

PostPosted: Thu Jul 10, 2014 1:12 pm
Reply with quote

@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
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2547
Location: Silicon Valley

PostPosted: Thu Jul 10, 2014 9:12 pm
Reply with quote

From the original post:
Quote:
what I want to have is (the second word is aligned on the 19th column)
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 -> TSO/ISPF

 


Similar Topics
Topic Forum Replies
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts Search two or more word with FILEAID Compuware & Other Tools 15
No new posts How to load to DB2 with column level ... DB2 6
No new posts RC query -Time column CA Products 3
Search our Forums:

Back to Top