View previous topic :: View next topic
|
Author |
Message |
cmsmoon
New User
Joined: 17 Jun 2010 Posts: 75 Location: Chennai
|
|
|
|
Hi Friends,
could you please help me how to delete blank line in a dataset using commends.
For exp:
The below data avaible in a PS
Raja
ravi
mani
mohan
ram
kani
after executing comments the results should be
Raja
ravi
mani
mohan
ram
kani |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Code: |
X ALL ' ' 1;DEL X ALL;SAVE |
|
|
Back to top |
|
|
cmsmoon
New User
Joined: 17 Jun 2010 Posts: 75 Location: Chennai
|
|
|
|
Thanks for your reply.
The record length is more than 50 means we cann't use this commend right? |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Why so specific that you need using Macro? |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2593 Location: Silicon Valley
|
|
|
|
Code: |
x p'^' all
flip
del all x
|
|
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10886 Location: italy
|
|
|
|
Quote: |
The record length is more than 50 means we cann't use this commend right? |
NO ... WRONG.
instead of posting irrelevant comments wouldn ' t it be faster to try?
( even on a small file ) |
|
Back to top |
|
|
Gary McDowell
Active User
Joined: 15 Oct 2012 Posts: 139 Location: USA
|
|
|
|
Pandora-Box wrote: |
Code: |
X ALL ' ' 1;DEL X ALL;SAVE |
|
Nice! I never thought of that.
Off the top of my head I would have done…
SORT
delete the blank lines
...but I like the X ALL solution better.
Thanks. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10886 Location: italy
|
|
|
|
IMO Pedro suggestion is better
it will find non blank characters in any position of the record |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2593 Location: Silicon Valley
|
|
|
|
Based on the sample data, Pandora's commands will work.
But the data shown was too simple for 'how to delete blank line?'. If you have blanks in the first 20 columns but have data anywhere in columns 20 - 80, it will delete those lines as well.
My example will only delete lines that do not have any other characters. |
|
Back to top |
|
|
Gary McDowell
Active User
Joined: 15 Oct 2012 Posts: 139 Location: USA
|
|
|
|
Pedro wrote: |
Code: |
x p'^' all
flip
del all x
|
|
Hmm, I did the following with the test data in original post and all lines were deleted. Not sure what I did incorrectly.
X P'^' ALL;FLIP;DEL ALL X |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10886 Location: italy
|
|
|
|
I usually go for ..
Code: |
EXCLUDE ALL
FIND P'^' ALL
DEL X ALL |
watch for the ^ character depending on the codepage used it might be translated to something else |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1787 Location: Bloomington, IL
|
|
|
|
Gary McDowell wrote: |
Pedro wrote: |
Code: |
x p'^' all
flip
del all x
|
|
Hmm, I did the following with the test data in original post and all lines were deleted. Not sure what I did incorrectly.
X P'^' ALL;FLIP;DEL ALL X |
You recognize that the circumflex (^) has been substituted for the logical NOT (¬)? P'¬' is interpreted by Edit as "all non-spaces"; P'^' is interpreted as "all circumflexes". |
|
Back to top |
|
|
Gary McDowell
Active User
Joined: 15 Oct 2012 Posts: 139 Location: USA
|
|
|
|
enrico-sorichetti wrote: |
I usually go for ..
Code: |
EXCLUDE ALL
FIND P'^' ALL
DEL X ALL |
watch for the ^ character depending on the codepage used it might be translated to something else |
Hmm, same result; all 8-lines of the test data were deleted. I ask two other developers to try also and we all got the data deleted.
Hey, thanks anyway. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10886 Location: italy
|
|
|
|
Quote: |
Hmm, same result; all 8-lines of the test data were deleted. I ask two other developers to try also and we all got the data deleted. |
unfortunately Your 3270 codepage is <fouled> up
just tested with the 1047 codepage and it works just right |
|
Back to top |
|
|
Gary McDowell
Active User
Joined: 15 Oct 2012 Posts: 139 Location: USA
|
|
|
|
enrico-sorichetti wrote: |
unfortunately Your 3270 codepage is <fouled> up
just tested with the 1047 codepage and it works just right |
Yep, we have 3270's. Bummer. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
Yep, we have 3270's. Bummer. |
Uh - MisUnderstandingAlert . . .
We pretty much ALL use 3270 Emulation - this is the "standard" terminal interface to the mainframe.
The Codepages are different definitions of how characters are to be handled. Whet Enrico posted says that usng the code page 1047, the process works.
Suggest you talk with whoever supports your terminal emulator product to see how yours is configured. |
|
Back to top |
|
|
cmsmoon
New User
Joined: 17 Jun 2010 Posts: 75 Location: Chennai
|
|
|
|
Akatsukami wrote: |
Gary McDowell wrote: |
Pedro wrote: |
Code: |
x p'^' all
flip
del all x
|
|
Hmm, I did the following with the test data in original post and all lines were deleted. Not sure what I did incorrectly.
X P'^' ALL;FLIP;DEL ALL X |
You recognize that the circumflex (^) has been substituted for the logical NOT (¬)? P'¬' is interpreted by Edit as "all non-spaces"; P'^' is interpreted as "all circumflexes". |
Thanks it is working |
|
Back to top |
|
|
GuyC
Senior Member
Joined: 11 Aug 2009 Posts: 1281 Location: Belgium
|
|
|
|
fyi : del all nx = flip ; del all x |
|
Back to top |
|
|
Ranjithkumar
New User
Joined: 10 Sep 2008 Posts: 93 Location: India
|
|
|
|
Try Akatsukami's suggestion in 3270, that will work.
Code: |
x all p'¬'
flip
del all x
|
|
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2593 Location: Silicon Valley
|
|
|
|
Quote: |
fyi : del all nx = flip ; del all x |
If you use DEL ALL NX, your screen will have only excluded lines. You will not see what you want to see. |
|
Back to top |
|
|
Binop B
Active User
Joined: 18 Jun 2009 Posts: 407 Location: Nashville, TN
|
|
|
|
Ranjithkumar wrote: |
Try Akatsukami's suggestion in 3270, that will work.
Code: |
x all p'¬'
flip
del all x
|
|
I was not sure initially how to type the '⌐' character. Just for those who are not sure how to do that - You will need to type '1', '6', '9' keeping the ALT button pressed in the keyboard....
Hope this method works for everybody |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2593 Location: Silicon Valley
|
|
|
|
Quote: |
Yep, we have 3270's. Bummer. |
Can you elaborate on the 'Bummer'?. |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2593 Location: Silicon Valley
|
|
|
|
Quote: |
I was not sure initially how to type the '⌐' character. Just for those who are not sure how to do that |
More typically, it is a simple Shift/6 (uppercase of number 6). When you type it in the editor, it should add the ^ character which is '5F'x. |
|
Back to top |
|
|
Binop B
Active User
Joined: 18 Jun 2009 Posts: 407 Location: Nashville, TN
|
|
|
|
Hi Pedro,
Shift/6 is typing in the '^' character. When I give this command on the TSO it is not working as expected. The '⌐' (ALT-1 6 9) is working though ... |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1787 Location: Bloomington, IL
|
|
|
|
Gary McDowell wrote: |
enrico-sorichetti wrote: |
unfortunately Your 3270 codepage is <fouled> up
just tested with the 1047 codepage and it works just right |
Yep, we have 3270's. Bummer. |
As in honest-to-Kamisami 327x terminals as used in the 1970s? |
|
Back to top |
|
|
|