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

Any TSO command to delete a column or some columns of PS??


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

New User


Joined: 23 Dec 2006
Posts: 10
Location: SYDNEY

PostPosted: Mon Dec 25, 2006 9:10 pm
Reply with quote

Is there any TSO command to delete a column or some columns of a flat file???
Back to top
View user's profile Send private message
PeD

Active User


Joined: 26 Nov 2005
Posts: 459
Location: Belgium

PostPosted: Mon Dec 25, 2006 10:00 pm
Reply with quote

use BOUNDS
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Tue Dec 26, 2006 12:10 am
Reply with quote

You can try this:

Suppose you want to delete cols 5 thru 9. In ISPF Edit enter the following in the cmd line:

c all 5 9 p'=' '' (note: there are no spaces in ''. BTW those are 2 single quotes, not a double quote.)

As I recall, the length of the PS stays the same (verify this).
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2358
Location: Israel

PostPosted: Tue Dec 26, 2006 10:31 am
Reply with quote

And just to make it clearer, those are not TSO commands, they are ISPF edit command.

O.
Back to top
View user's profile Send private message
bvanilkumar

New User


Joined: 23 Dec 2006
Posts: 10
Location: SYDNEY

PostPosted: Tue Dec 26, 2006 6:08 pm
Reply with quote

mmwife wrote:
You can try this:

Suppose you want to delete cols 5 thru 9. In ISPF Edit enter the following in the cmd line:

c all 5 9 p'=' '' (note: there are no spaces in ''. BTW those are 2 single quotes, not a double quote.)

As I recall, the length of the PS stays the same (verify this).



It working well to blank the columns. But is there any way to delete the columns between 5 and 9, move 10th column to 5th column, 11th to 6th...??? File length may remain same.
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2358
Location: Israel

PostPosted: Tue Dec 26, 2006 6:53 pm
Reply with quote

Here's an edit-macro I wrote in the past:
Code:
/*------------------------------- REXX ------------------------------- 
 * PROGRAM   : DELCOLS                                                 
 * FUNCTION  : Delete range of columns.                                 
 * AUTHOR    : OFER                                                     
 * DATE      : 04/04/04                                                 
 * HOW TO USE:                                                         
 *           :                                                         
 *------------------------------------------------------------------*/ 
                                                                       
ADDRESS ISREDIT "MACRO (SPOS EPOS FROM) PROCESS"                       
ADDRESS ISPEXEC "CONTROL ERRORS RETURN"                                 
ADDRESS ISREDIT "(RECLEN) = LRECL"                                     
                                                                       
IF EPOS = ' ' THEN EPOS = RECLEN                                       
                                                                       
IF FROM = ' ' | FROM = 'FROM' THEN FROM = 1                             
                                                                       
IF DATATYPE(EPOS) ?= 'NUM' | DATATYPE(SPOS) ?= 'NUM' THEN DO           
  ZEDLMSG = 'Specify numeric starting and ending columns to be deletet.'
  ADDRESS ISPEXEC "SETMSG MSG(ISRZ000)"                                 
  EXIT                                                                 
END                                                                     
IF EPOS - SPOS < 0 THEN DO                                             
  ZEDLMSG = 'Starting position greater then ending position !!!'       
  ADDRESS ISPEXEC "SETMSG MSG(ISRZ000)"                                 
  EXIT                                                                 
END                                                                     
                                                                       
ADDRESS ISREDIT "(LASTL)  = LINENUM .ZLAST  "                           
                                                                       
DO I = FROM TO LASTL                                                   
  ADDRESS ISREDIT "(CURRLINE) = LINE &I"                               
  LEFT    = SUBSTR(CURRLINE,1,SPOS-1)                                   
  RIGHT   = SUBSTR(CURRLINE,EPOS+1)                                     
  NEWLINE = LEFT||RIGHT                                                 
  ADDRESS ISREDIT "LINE &I = (NEWLINE)"                                 
END                                                                     

EXIT


O.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Wed Dec 27, 2006 5:42 am
Reply with quote

bvanilkumar,

I forgot that edit ignores spaces in this case. What I've done is change the spaces in the range you're woking in to a printable char (I use ~)
then do as I suggested.

I tried it and it works. Are you sure you're using '' and NOT 'b' (where b is a space)?.

Just enter c all 5 9 'b' '~' before you enter the cmds I suggested yesterday.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Wed Dec 27, 2006 5:55 am
Reply with quote

Ofer said,
Quote:
And just to make it clearer, those are not TSO commands, they are ISPF edit command.


And "GDG versions" are GDG entries; "PDS PSs" are PDS members and "JCLs" is JCL to pick a few. Don't get me started, but I wish you luck on your quest. icon_smile.gif
Back to top
View user's profile Send private message
DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Wed Dec 27, 2006 7:31 am
Reply with quote

Pierre,

There are many ways to accomplish the problem at hand. I like to use 'BNDS' to do this type of manipulation also.

Since you brought it up first, How about giving a clear example, from start to finish how this would work with 'BNDS' ?

icon_smile.gif
Back to top
View user's profile Send private message
PeD

Active User


Joined: 26 Nov 2005
Posts: 459
Location: Belgium

PostPosted: Wed Dec 27, 2006 2:03 pm
Reply with quote

Why not ! even if I prefer the person open the manual by himself.

suppose
Code:
****** ********************************* Top of Data **********************************
=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
000001 AAAA11111ABBBCCCCCCCCCCDDDDDDDEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE                     
000002 AAAA11111ABBBCCCCCCCCCCDDDDDDDEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE                     
000003 AAAA11111ABBBCCCCCCCCCCDDDDDDDEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE                     
000004 AAAA11111ABBBCCCCCCCCCCDDDDDDDEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE                     
000005 AAAA11111ABBBCCCCCCCCCCDDDDDDDEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE                     
000006 AAAA11111ABBBCCCCCCCCCCDDDDDDDEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE                     
****** ******************************** Bottom of Data ********************************                                                     


Type on first command line
Code:
bnds01 AAAA11111ABBBCCCCCCCCCCDDDDDDDEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE

to receive
Code:
 =COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
 =BNDS> <                                                                              >
 000001 AAAA11111ABBBCCCCCCCCCCDDDDDDDEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE                   

move the < sign at desired position here pos 5
Code:
=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
=BNDS>     <                                                                          >
000001 AAAA11111ABBBCCCCCCCCCCDDDDDDDEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE                     

and using ((5 on from line and (( on last line, the file is modified. Then restore BNDS.

Code:
=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
=BNDS>     <                                                                          >
((5001 AAAA11111ABBBCCCCCCCCCCDDDDDDDEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE                   
000002 AAAA11111ABBBCCCCCCCCCCDDDDDDDEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE                   
000003 AAAA11111ABBBCCCCCCCCCCDDDDDDDEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE                   
000004 AAAA11111ABBBCCCCCCCCCCDDDDDDDEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE                   
000005 AAAA11111ABBBCCCCCCCCCCDDDDDDDEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE                   
((0006 AAAA11111ABBBCCCCCCCCCCDDDDDDDEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE                   

finally
Code:
=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
=BNDS>     <                                                                          >
000001 AAAAABBBCCCCCCCCCCDDDDDDDEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE                         
000002 AAAAABBBCCCCCCCCCCDDDDDDDEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE                         
000003 AAAAABBBCCCCCCCCCCDDDDDDDEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE                         
000004 AAAAABBBCCCCCCCCCCDDDDDDDEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE                         

Save it and go to work...
Happy end of year
Cheers
Pierre
Back to top
View user's profile Send private message
DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Wed Dec 27, 2006 9:24 pm
Reply with quote

Good post Pierre,

Just a couple of additions,

?BNDS? can be controlled from the Primary command line also.

?BDNS 5 80? as a Primary Command would accomplish the same thing as using ?BNDS? as a line command.

?BNDS? as a primary Command will reset the bounds to their default values.
Back to top
View user's profile Send private message
bvanilkumar

New User


Joined: 23 Dec 2006
Posts: 10
Location: SYDNEY

PostPosted: Thu Dec 28, 2006 2:10 pm
Reply with quote

PeD wrote:
Why not ! even if I prefer the person open the manual by himself.

suppose
Code:
****** ********************************* Top of Data **********************************
=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
000001 AAAA11111ABBBCCCCCCCCCCDDDDDDDEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE                     
000002 AAAA11111ABBBCCCCCCCCCCDDDDDDDEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE                     
000003 AAAA11111ABBBCCCCCCCCCCDDDDDDDEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE                     
000004 AAAA11111ABBBCCCCCCCCCCDDDDDDDEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE                     
000005 AAAA11111ABBBCCCCCCCCCCDDDDDDDEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE                     
000006 AAAA11111ABBBCCCCCCCCCCDDDDDDDEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE                     
****** ******************************** Bottom of Data ********************************                                                     


Type on first command line
Code:
bnds01 AAAA11111ABBBCCCCCCCCCCDDDDDDDEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE

to receive
Code:
 =COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
 =BNDS> <                                                                              >
 000001 AAAA11111ABBBCCCCCCCCCCDDDDDDDEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE                   

move the < sign at desired position here pos 5
Code:
=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
=BNDS>     <                                                                          >
000001 AAAA11111ABBBCCCCCCCCCCDDDDDDDEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE                     

and using ((5 on from line and (( on last line, the file is modified. Then restore BNDS.

Code:
=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
=BNDS>     <                                                                          >
((5001 AAAA11111ABBBCCCCCCCCCCDDDDDDDEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE                   
000002 AAAA11111ABBBCCCCCCCCCCDDDDDDDEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE                   
000003 AAAA11111ABBBCCCCCCCCCCDDDDDDDEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE                   
000004 AAAA11111ABBBCCCCCCCCCCDDDDDDDEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE                   
000005 AAAA11111ABBBCCCCCCCCCCDDDDDDDEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE                   
((0006 AAAA11111ABBBCCCCCCCCCCDDDDDDDEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE                   

finally
Code:
=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
=BNDS>     <                                                                          >
000001 AAAAABBBCCCCCCCCCCDDDDDDDEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE                         
000002 AAAAABBBCCCCCCCCCCDDDDDDDEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE                         
000003 AAAAABBBCCCCCCCCCCDDDDDDDEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE                         
000004 AAAAABBBCCCCCCCCCCDDDDDDDEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE                         

Save it and go to work...
Happy end of year
Cheers
Pierre



Good post pierre, it really worked well.
I have never used this 'BOUNDS'.
What other things can be done with using 'BOUNDS'????

Thanks,
Anil Kumar BV
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 RACF - Rebuild SETROPTS command which... All Other Mainframe Topics 3
No new posts DELETE SPUFI DB2 1
No new posts DSNTIAUL driven delete IBM Tools 0
No new posts Routing command Address SDSF to other... TSO/ISPF 2
Search our Forums:

Back to Top