How to delete four lines



IBM's Command List programming language & Restructured Extended Executor

How to delete four lines

Postby samurai » Tue Apr 15, 2014 11:31 pm

Hello,

I have tried deleting a single line and wrote into another pds using if statement as

if (index(recd.i,SORT) > 0 ) then

....

i need to delete in all the members of same pds so it need to go in loop? If so what condition, please let me know....

also i have used two if statement to find a word in single line, but can someone let me know to delete some 4 lines as below:

SORT SYSIN
DD ALLOC
DSN ='....'
UNIT =TAPE



Please let me know to continue further to delete from SORT to UNIT = TAPE

Thanks!
samurai
 
Posts: 30
Joined: Tue Mar 18, 2014 3:29 pm
Has thanked: 6 times
Been thanked: 0 time

Re: How to delete four lines

 

Re: How to delete four lines

Postby Pedro » Wed Apr 16, 2014 3:16 am

Your question is not clear, but I think you want to skip a process for several consecutive lines. How about using a state indicator that you turn on and off?

1. default setting is on
...
2. turn off when you find the first record
3. If (on) then process record
4. turn on when you find the last record.
Pedro Vera
User avatar
Pedro
 
Posts: 571
Joined: Thu Jul 31, 2008 9:59 pm
Location: Silicon Valley
Has thanked: 0 time
Been thanked: 40 times

Re: How to delete four lines

Postby samurai » Wed Apr 16, 2014 11:13 am

Yeah Pedro Thanks!

I was trying to skip some 4 lines and if founf i will skip those by not writing into file as simply giving Do...End as empty like,

if (index(recd.i,SORT) > 0 ) then
DO
END
else
write record

ON & OFF i didnt try... let me try this...
samurai
 
Posts: 30
Joined: Tue Mar 18, 2014 3:29 pm
Has thanked: 6 times
Been thanked: 0 time

Re: How to delete four lines

Postby NicC » Wed Apr 16, 2014 2:56 pm

2 ways to change what you have:

if (index(recd.i,SORT) > 0 ) then
NOP
else
write record

or
if (index(recd.i,SORT) = 0 )
then write record
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2702
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisys (almost)
Has thanked: 4 times
Been thanked: 105 times

Re: How to delete four lines

Postby samurai » Wed Apr 16, 2014 7:57 pm

Hi Pedro,

could you help me in getting the syntax. Thanks!
samurai
 
Posts: 30
Joined: Tue Mar 18, 2014 3:29 pm
Has thanked: 6 times
Been thanked: 0 time

Re: How to delete four lines

Postby Pedro » Wed Apr 16, 2014 9:12 pm

I can help a little bit. My main suggestion was about a state indicator. Basically, if an IF statement is true, the THEN clause is performed. And true is indicated by a numeric 1. A false is a zero.

My suggestion had four bullets:

1. default setting is on
usethis = 1

...
Do steps 2-4 in a loop.
2. turn off (set to zero) when you find the first record

3. If (on) then process record
If (usethis) Then
   Write record...


4. turn on (set to one) when you find the last record.
Pedro Vera
User avatar
Pedro
 
Posts: 571
Joined: Thu Jul 31, 2008 9:59 pm
Location: Silicon Valley
Has thanked: 0 time
Been thanked: 40 times


Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post