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
 

 

Delete lines from a PS Using REXX

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> TSO/ISPF
View previous topic :: :: View next topic  
Author Message
VijayKrish

New User


Joined: 30 Jun 2010
Posts: 10
Location: India

PostPosted: Wed Jul 07, 2010 12:43 am    Post subject: Delete lines from a PS Using REXX
Reply with quote

Hi,
I have a requirement to code in REXX. My Input file looks like below.

MODULEA RGN1
MODULEB RGN1
MODULEC RGN3
MODULEA RGN2
MODULEA RGN3
MODULEB RGN4
MODULEA RGN5
MODULEC RGN6

I wanted to remove the record from the file, where the module name occurs for the second time. My output should look like this.
MODULEA RGN1
MODULEB RGN1
MODULEC RGN3

Please provide me the code in REXX to this activity.
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Jul 07, 2010 12:58 am    Post subject:
Reply with quote

I realize that it is not REXX, but instead a CLIST, and it excludes the dups

Code:

ISREDIT MACRO
CONTROL NOLIST NOCONLIST NOSYMLIST NOPROMPT NOMSG NOFLUSH ASIS END(ENDO)
ISREDIT RESET
ISREDIT (NUMLNS) = LINENUM .ZL
ISREDIT (CURLN) = LINENUM .ZF
SET LASTLN = &STR()
SET THISLN = &STR()
SET &STCOL = 1
SET &ENDCOL = 40
DO WHILE &CURLN < &NUMLNS + 1
    ISREDIT (THISLN) = LINE &CURLN
    SET THISLN =  &SUBSTR(&STCOL:&ENDCOL,&THISLN)
    IF  &STR(&THISLN) = &STR(&LASTLN) THEN +
        DO
          ISREDIT CURSOR =  &CURLN
          ISREDIT EXCLUDE ALL .ZCSR .ZCSR
        ENDO
    SET LASTLN = &STR(&THISLN)
    SET LSTLN = &CURLN
    SET CURLN = &CURLN + 1
    ENDO
EXIT



a quick attempt to convert to rexx is as follows:

Code:

/* REXX  */
ISREDIT MACRO
ISREDIT RESET
ISREDIT (NUMLNS) = LINENUM .ZL
ISREDIT (CURLN) = LINENUM .ZF
LASTLN = ""
THISLN = ""
STCOL = 1         /*  change the start col and endcol              */
ENDCOL = 40       /*  depending on your need                       */
/*                    or simply enter the start col and end column */
/*                    as arguments                                 */
/*                                                                 */
DO WHILE CURLN < NUMLNS + 1
    ISREDIT (THISLN) = LINE CURLN
    THISLN =  SUBSTR(THISLN,STCOL,ENDCOL)
    IF  THISLN = LASTLN THEN +
        DO
          ISREDIT CURSOR =  CURLN
          ISREDIT EXCLUDE ALL .ZCSR .ZCSR
        END
    LASTLN = THISLN
    LSTLN = CURLN
    CURLN = CURLN + 1
    END
EXIT



at the end of the rexx you can type in DELETE ALL X
or you can put the command in the REXX macro.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10232
Location: italy

PostPosted: Wed Jul 07, 2010 12:59 am    Post subject: Reply to: Delete lines from a PS Using REXX
Reply with quote

Quote:
Please provide me the code in REXX to this activity.

as soon You have provided the proper fee

this is a help forum, not a do it for me one
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Jul 07, 2010 1:07 am    Post subject:
Reply with quote

Sorry enrico,

could not help myself.
we can charge we he starts asking for explanation.
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2360
Location: Israel

PostPosted: Wed Jul 07, 2010 1:11 am    Post subject:
Reply with quote

Note that if it is a large dataset, an Edit-Macro won't do the job.

I recommend invoking SORT from within REXX - much faster & possibly less error-exposed.

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

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Wed Jul 07, 2010 11:30 am    Post subject:
Reply with quote

ofer71 wrote:
Note that if it is a large dataset, an Edit-Macro won't do the job.

I recommend invoking SORT from within REXX - much faster & possibly less error-exposed.

O.

Ditto, also if the dataset is on tape and the REXX runs in foreground.
Quotes for code and testing available on request icon_lol.gif
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Jul 07, 2010 7:24 pm    Post subject:
Reply with quote

Hello,

Quote:
I have a requirement to code in REXX.
Someone "who must be obeyed" may have dictated that rexx be used, but there is no business requirement to use rexx. . .

The business requirement is to deal with the duplicates.

Whichever is a proper tool should be used. . .

Sounds like once again, someone has found a neat little hammer (rexx) and wants everything to be done to be a nail . . .
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 REXX cdoe to purge a JOB from spool a... Sulabh Agrawal CLIST & REXX 11 Thu Mar 09, 2017 11:36 am
No new posts Overriding PS data in rexx Shaheen Shaik CLIST & REXX 8 Fri Mar 03, 2017 5:08 pm
No new posts REXX compiled via RXTCOMP sergeyken CLIST & REXX 7 Tue Feb 07, 2017 9:41 pm
This topic is locked: you cannot edit posts or make replies. Calling REXX code from ISPF panel sanchita dey TSO/ISPF 4 Mon Jan 02, 2017 5:13 pm
No new posts REXX DB2: Dynamic allocation of DB2.D... BHAS CLIST & REXX 3 Mon Dec 19, 2016 8:26 pm


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