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
 

 

Align second word to specific column

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> TSO/ISPF
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    Post subject: Align second word to specific column
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Tue Jul 08, 2014 12:15 pm    Post subject: Reply to: Align second word to specific column
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: 1028
Location: Oostende, Belgium

PostPosted: Tue Jul 08, 2014 12:15 pm    Post subject:
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    Post subject:
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: 51
Location: Switz

PostPosted: Wed Jul 09, 2014 12:44 pm    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Wed Jul 09, 2014 12:55 pm    Post subject: Reply to: Align second word to specific column
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

Senior Member


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

PostPosted: Wed Jul 09, 2014 10:59 pm    Post subject: Reply to: Align second word to specific column
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

Senior Member


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

PostPosted: Wed Jul 09, 2014 11:22 pm    Post subject: Reply to: Align second word to specific column
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: 51
Location: Switz

PostPosted: Thu Jul 10, 2014 1:12 pm    Post subject:
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

Senior Member


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

PostPosted: Thu Jul 10, 2014 9:12 pm    Post subject: Reply to: Align second word to specific column
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    IBMMAINFRAMES.com Support Forums -> TSO/ISPF All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Loading data to table gives wrong for... Raghu navaikulam DB2 19 Thu Jul 13, 2017 2:11 pm
No new posts How to write Specific Fields from Mul... Padhu SYNCSORT 6 Thu Jul 06, 2017 10:26 am
No new posts Route a product's job to specific lpar vasanthz All Other Mainframe Topics 9 Thu Mar 02, 2017 2:22 am
This topic is locked: you cannot edit posts or make replies. DB2 query Using Recursion, Converting... smilewithashu2 DB2 3 Tue Jan 03, 2017 12:50 pm
No new posts SQZ pipe delimited file with 1 column... Rick Silvers DFSORT/ICETOOL 6 Sun Nov 06, 2016 8:11 pm


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