View previous topic :: View next topic
|
Author |
Message |
bvanilkumar
New User
Joined: 23 Dec 2006 Posts: 10 Location: SYDNEY
|
|
|
|
Is there any TSO command to delete a column or some columns of a flat file??? |
|
Back to top |
|
|
PeD
Active User
Joined: 26 Nov 2005 Posts: 459 Location: Belgium
|
|
|
|
use BOUNDS |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
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 |
|
|
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
And just to make it clearer, those are not TSO commands, they are ISPF edit command.
O. |
|
Back to top |
|
|
bvanilkumar
New User
Joined: 23 Dec 2006 Posts: 10 Location: SYDNEY
|
|
|
|
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 |
|
|
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
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 |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
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 |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
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. |
|
Back to top |
|
|
DavidatK
Active Member
Joined: 22 Nov 2005 Posts: 700 Location: Troy, Michigan USA
|
|
|
|
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' ?
|
|
Back to top |
|
|
PeD
Active User
Joined: 26 Nov 2005 Posts: 459 Location: Belgium
|
|
|
|
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 |
|
|
DavidatK
Active Member
Joined: 22 Nov 2005 Posts: 700 Location: Troy, Michigan USA
|
|
|
|
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 |
|
|
bvanilkumar
New User
Joined: 23 Dec 2006 Posts: 10 Location: SYDNEY
|
|
|
|
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 |
|
|
|