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

Delete lines from a PS Using REXX


IBM Mainframe Forums -> TSO/ISPF
Post new topic   Reply to topic
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
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
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Jul 07, 2010 12:59 am
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
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: 2358
Location: Israel

PostPosted: Wed Jul 07, 2010 1:11 am
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: 8797
Location: Welsh Wales

PostPosted: Wed Jul 07, 2010 11:30 am
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

Moderator Emeritus


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

PostPosted: Wed Jul 07, 2010 7:24 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> TSO/ISPF

 


Similar Topics
Topic Forum Replies
No new posts Compile Several JCL JOB Through one r... CLIST & REXX 4
No new posts Running REXX through JOB CLIST & REXX 13
No new posts Error to read log with rexx CLIST & REXX 11
No new posts DELETE SPUFI DB2 1
No new posts isfline didnt work in rexx at z/OS ve... CLIST & REXX 7
Search our Forums:

Back to Top