Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search 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 -> CLIST & REXX
Author Message
VijayKrish

New User


Joined: 30 Jun 2010
Posts: 7
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
References
dbzTHEdinosauer

Senior Member


Joined: 20 Oct 2006
Posts: 4457
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: 6006
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

Senior Member


Joined: 20 Oct 2006
Posts: 4457
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: 2385
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: 7430
Location: Brussels once more ...

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

Global Moderator


Joined: 23 Nov 2006
Posts: 15201
Location: 221 B Baker St

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
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1