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

Search a string and delete.


IBM Mainframe Forums -> TSO/ISPF
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Srinivasarangam
Warnings : 1

New User


Joined: 01 Jun 2010
Posts: 39
Location: India

PostPosted: Fri May 25, 2012 6:28 pm
Reply with quote

hey nic,

don't under estimate someone so easily and start passing comments....

i got the solution....

i have acheived that as below

Code:
ADDRESS "TSO"                                   
  "ALLOC DA('"INPUT0"') F(INDF) SHR REUSE"     
  "EXECIO * DISKR INDF(STEM LINES. FINIS"       
  DO I = 1 TO LINES.0                           
     IF  SUBSTR(LINES.I,7,1) <> '*' THEN       
     DO                                         
         J = J + 1                             
         A.J = 'HELLO'                         
         "EXECIO * DISKW INDF (FINIS STEM A."   
     END                                       

before writing this type of comments, please think once. No one is born intelligent... even you... I never asked anyone for code .. i requested ideas from everyone thinking you all are experts in rexx as i am very rarely work on rexx and as i don't have much exposure to rexx
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Fri May 25, 2012 6:32 pm
Reply with quote

not to belabor a point:
Quote:
No one is born intelligent

that is untrue.

No one is born with knowledge <<<< now that is true.
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Fri May 25, 2012 6:34 pm
Reply with quote

Good Job. Not how I would do it, but if you say it works, then great.

You probably want to move "EXECIO * DISKW INDF (FINIS STEM A." outside of your DO I = loop however.

You are writing ALL the lines of your A. stem every time instead of just once at the end.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Fri May 25, 2012 8:10 pm
Reply with quote

Well, I may have been a bit harsh but not too much and obviously I am not particularly serious but you did say "nothing is working with me". with that amount of information how can we help you with your problem which, if you got it fixed, could well provide you with something that you can use as a foundation for future efforts? If you need to get more exposure to Rexx you can download free rexx interpreters for your pc and practice there. You would then only need to learn the bits that are specific to z/OS and ISPF e.g. EXECIO instead of the ANSI standard I/O routines.
Back to top
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2545
Location: Silicon Valley

PostPosted: Fri May 25, 2012 9:25 pm
Reply with quote

Maybe I am not interpreting it correctly, but
Quote:
I never asked anyone for code ..

and
Quote:
I don't have any sample code. If anyone of you have the sample, request you to share the same.
Back to top
View user's profile Send private message
Srinivasarangam
Warnings : 1

New User


Joined: 01 Jun 2010
Posts: 39
Location: India

PostPosted: Fri May 25, 2012 9:44 pm
Reply with quote

Nic,

If i said anything wrong .. please excuse me. As I am new to rexx i think i am not asking correct questions with you all.
Really the suggestions you all given is helping me a to build my confidence that i also can also code in rexx. I am going through manuals and other samples in google. Thank you all for all your help. Going forward I may still distrub you all... Please excuse me
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Fri May 25, 2012 9:50 pm
Reply with quote

It is not a disruption if you do the following:

1) Be specific and consistent with your requirements. Do not leave out important details.

2) Answer any and all questions asked. People do not ask if it is not important.

3) Do not say 'it didn't work". You must show an eror message you explain to results.
Back to top
View user's profile Send private message
Srinivasarangam
Warnings : 1

New User


Joined: 01 Jun 2010
Posts: 39
Location: India

PostPosted: Sat May 26, 2012 9:25 pm
Reply with quote

Till now i tried to search and delete a string in PS and its working fine now. Now I am trying to search and delete a string in PDS member. I am trying my best to find solution for the error. Please find the below code and in TRACE I, I am getting this below error. Please help to fix the error.
Code:
/* REXX */                                           
TRACE I                                               
ARG  J STR STR1 STR2                                 
STR = STR1 = STR2 = ''                               
J = 0                                                 
                                                     
INPUT0 = T310753.IIRS.FE.DATA                         
INPUT1 = ZQGSX07                                     
STR = 'MARROYO@US.IMSHEALTH.COM'                     
                                                     
ADDRESS "TSO"                                         
   "ALLOC F(INDF) DS('"INPUT0"("INPUT1")') SHR REUSE"
  "EXECIO * DISKR" INDF "(FINIS STEM LINES."         
  DO  I = 1 TO LINES.0                               
      SAY  LINES.I                                   
  END                                                 
  "FREE F(INDF)"                                     
  DO I = 1 TO LINES.0                                 
     B.I = LINES.I                                   
     PARSE VAR LINES.I STR1 '>' STR2 '<' STR3         
         IF  STR <> STR2  THEN                       
         DO                                           
             J = J + 1                               
             A.J = B.I                               
             "EXECIO * DISKW INDF (FINIS STEM A."     
         END                                         
  END                                                 
EXIT                                                 
Code:
    7 *-* INPUT0 = T310753.IIRS.FE.DATA                                       
      >L>   "T310753.IIRS.FE.DATA"                                           
    8 *-* INPUT1 = ZQGSX07                                                   
      >L>   "ZQGSX07"                                                         
    9 *-* STR = 'MARROYO@US.IMSHEALTH.COM'                                   
      >L>   "MARROYO@US.IMSHEALTH.COM"                                       
   11 *-* ADDRESS "TSO"                                                       
   12 *-* "ALLOC F(INDF) DS('"INPUT0"("INPUT1")') SHR REUSE"                 
      >L>   "ALLOC F(INDF) DS('"                                             
      >V>   "T310753.IIRS.FE.DATA"                                           
      >O>   "ALLOC F(INDF) DS('T310753.IIRS.FE.DATA"                         
      >L>   "("                                                               
      >O>   "ALLOC F(INDF) DS('T310753.IIRS.FE.DATA("                         
      >V>   "ZQGSX07"                                                         
      >O>   "ALLOC F(INDF) DS('T310753.IIRS.FE.DATA(ZQGSX07"                 
      >L>   ")') SHR REUSE"                                                   
      >O>   "ALLOC F(INDF) DS('T310753.IIRS.FE.DATA(ZQGSX07)') SHR REUSE"     
   13 *-* "EXECIO * DISKR" INDF "(FINIS STEM LINES."                                 >L>   "EXECIO * DISKR"                                   
       >L>   "INDF"                                             
       >O>   "EXECIO * DISKR INDF"                               
       >L>   "(FINIS STEM LINES."                               
       >O>   "EXECIO * DISKR INDF (FINIS STEM LINES."           
System abend code 013, reason code 00000020.                     
Abend in host command EXECIO or address environment routine TSO.
EXECIO error while trying to GET or PUT a record.               
       +++ RC(20) +++                                           
    14 *-* DO  I = 1 TO LINES.0                                 
       >L>   "1"                                                 
       >V>   "0"                                                 
    17 *-* "FREE F(INDF)"                                       
       >L>   "FREE F(INDF)"                                     
    18 *-* DO I = 1 TO LINES.0                                   
       >L>   "1"                                                 
       >V>   "0"                                                 
    28 *-* EXIT                                                 
***                                                             
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Sat May 26, 2012 9:46 pm
Reply with quote

OK - you have a 013 - generally means that the member is not found - depends on the reason code. You should also check - because I cannot, at the moment, the file types that EXECIO can use - I know it cannot do VSAM fro example but I certainly wouldn't think twice about using it for a PDS member - whixh is, after all, just PS file. So, after that digression, check that your member exists. in the pds specified. I would also try putting quotes around data strings - in this case the string that you are assigning to input0 becaus - as you know, TSO likes to add your usirid at the fron of DSNs that are unquoted so use quotes all the way through.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Sat May 26, 2012 9:49 pm
Reply with quote

well you insist on using EXECIO and a ton of bs code
instead of an EDIT Macro to do your work,

anyway

from the manual:
"EXECIO * DISKR MYINDD (FINIS STEM MYVAR"

see anything different between what the manual provides as syntax
and the stuff you coded.

when the file reference is within the quotes, the ds is addressed.
in your case, it is attempting to read an unallocated file name INDF.
Code:

   13 *-* "EXECIO * DISKR" INDF "(FINIS STEM LINES."                                 >L>   "EXECIO * DISKR"                                   
       >L>   "INDF"                                             
       >O>   "EXECIO * DISKR INDF"                               
       >L>   "(FINIS STEM LINES."                               
       >O>   "EXECIO * DISKR INDF (FINIS STEM LINES."   


Here is a manual for ISPEXEC Services

you refuse to accept anyone's advice on what to do technically,
you may want to follow Nic's career advice.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Sat May 26, 2012 9:53 pm
Reply with quote

i personnally use
TRACE ?R.
Back to top
View user's profile Send private message
Srinivasarangam
Warnings : 1

New User


Joined: 01 Jun 2010
Posts: 39
Location: India

PostPosted: Sat May 26, 2012 9:59 pm
Reply with quote

The PDS member i am trying to read is having record length 150. When I am trying with PDS member with record length 80 its working fine while reading but giving problem while writing as given below:
Code:
        >C>      "B.3"                                                         
        >V>      "           05  XS-REPORT               PIC  9(02).           
                   "                                                           
        >C>      "A.3"                                                         
     27 *-*    "EXECIO 1 DISKW INDF (FINIS STEM A."                           
        >L>      "EXECIO 1 DISKW INDF (FINIS STEM A."                         
 The input or output file INDF is not allocated. It cannot be opened for I/O. 
 EXECIO error while trying to GET or PUT a record.                             
        +++ RC(20) +++                                                         
     28 *-*   END                                                             
     29 *-* END                                                               
     20 *-* DO I = 1 TO LINES.0                                               
     21 *-*  B.I = LINES.I                                                     
        >C>    "LINES.4"                                                       
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Sat May 26, 2012 10:11 pm
Reply with quote

Quote:
output file INDF is not allocated


you need to ALLOC the file as input
EXECIO DISKR

do your stem manipulation

ALLOC the file as output (since it is an PDS member, remember to use SHR)
EXECIO DISKW

also, remember EXECIO DISKW stops at a null item in the stem.

the stem.0 value has no effect on EXECIO.
DISKR will populate stem.0

DISKW ignores the stem.0 value

the stem.0 value is only of use for your internal manipulations.
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Sat May 26, 2012 10:24 pm
Reply with quote

Hi Srini,

Your macro is just fine but I just added SAVE and do the SYSEXEC library


Code:
 /*REXX*/                                   
        ADDRESS ISREDIT "MACRO"             
        ADDRESS ISREDIT "X ALL '*' 7 7 "   
        ADDRESS ISREDIT "DELETE ALL X"     
        ADDRESS ISREDIT "SAVE"             
        EXIT                             



Code:
000001 FRANK               JAN            PILOT             50000             
000002 FRANK *             JAN            PILOT             50000             
000003 FRANK *             JAN            PILOT             50000             
000004 FRANK *             JAN            PILOT             50000   


After MYMACRO

Code:
EDIT       PANDORA.REXX(TEST4) - 01.01                 Columns 00001 00072
Command ===> MYMACRO                                          Scroll ===> CSR 
****** ***************************** Top of Data ******************************
000001 FRANK               JAN            PILOT             50000             
000002 FRANK *             JAN            PILOT             50000             
000003 FRANK *             JAN            PILOT             50000             
000004 FRANK *             JAN            PILOT             50000             
****** **************************** Bottom of Data ****************************


Changes to

Code:
EDIT       PANDORA.REXX(TEST4) - 01.02                 Columns 00001 00072
Command ===>                                                  Scroll ===> CSR 
****** ***************************** Top of Data ******************************
000001 FRANK               JAN            PILOT             50000             
****** **************************** Bottom of Data ****************************


How to add your macro to sysexec/sysproc

Go to TSO 6
Code:

   Menu  List  Mode  Functions  Utilities  Help                                 
 ------------------------------------------------------------------------------
                               ISPF Command Shell                               
 Enter TSO or Workstation commands below:                                       
                                                                               
 ===> isrddn                                                                   
                                                                               
                                                                               
                                                                               
 Place cursor on choice and press enter to Retrieve command                     
                                                                               
 => isrddn                                                                     
 =>                                                                             
 =>                                                                             
 =>                                                                             
 =>                                                                             
 =>                                                                             
 =>                                                                             
 =>                                                                             
 =>                                                                             
 =>                                                                             
                                       



After hitting enter you could see current dataset allocation after scolling down (PF8) you could see something similar to this in your application

Copy this mymacro to that SYSEXEC PDS with name (mymacro)

Code:
PAMES1   SHR,KEEP   >    SDSFMENU PAN.SPANPLIB                               
PAM001   SHR,KEEP   >    SYSEXEC  SYSPAM.REXXLIB                             
PAMR1F   SHR,KEEP   >             SYSPAM.USER.REXXLIB                         
PAMES1   SHR,KEEP   >             PAN.SPANEXEC                               
Z6DB81   SHR,KEEP   >             PANDORA.SDSQEXCE                             
PAMES1   SHR,KEEP   >    SYSHELP  PAN.SPANHELP                               
         NEW,DEL    >    SYSIN    ---------- Allocated to the terminal -------
Z6SYS1   SHR,KEEP   >    SYSLBC   SYS1.BRODCAST                               
         NEW,DEL    >    SYSPRINT ---------- Allocated to the terminal -------
PAM001   SHR,KEEP   >    SYSPROC  SYSPAM.CLIST                               
PAM001   SHR,KEEP   >             SYSPAM.PROCLIB                             
PAMES1   SHR,KEEP   >             PAN.SPANCLIB                               
         NEW,DEL    >    SYSTSPRT ---------- Allocated to the terminal -------
PAM001   SHR,KEEP   >    SYS00002 SYSPAM.REXXLIB                               
Back to top
View user's profile Send private message
Srinivasarangam
Warnings : 1

New User


Joined: 01 Jun 2010
Posts: 39
Location: India

PostPosted: Sat May 26, 2012 11:28 pm
Reply with quote

Dic,

Thank you.. Really TRACE ?R is too user friendly to trace the code.... Thanks a lot....
In my requirement I need to edit "all members in PDS with record length 150" and search for a string and delete that line.
The code is now working "PDS member with record length 80" after alloc is given for both input and output seperately. But not working for ""PDS member with record length 150", getting the same error msg in TRACE ?R. as given below. Is there any restrictions?

Code:
System abend code 013, reason code 00000020.
Abend in host command EXECIO or address environment routine TSO. 
EXECIO error while trying to GET or PUT a record.                 
       +++ RC(20) +++                                             
Back to top
View user's profile Send private message
Srinivasarangam
Warnings : 1

New User


Joined: 01 Jun 2010
Posts: 39
Location: India

PostPosted: Sat May 26, 2012 11:44 pm
Reply with quote

Dic,

Its working. In input1=ZQGSX07. was there. The '.' was invisible character found when BROWSE the my reexx code. after doing C ALL p'.' ' ' , its working fine.

screen shot of browse
Code:
/* REXX */                                             
TRACE ?R.                                               
ARG  J STR STR1 STR2                                   
STR = STR1 = STR2 = ''                                 
J = 0                                                   
   /*                                                   
INPUT0=T310753.IIRS.COBOL   /*    FE.DATA */           
INPUT1=COP1                     /*   ZQGSX07  */       
 */                                                     
INPUT0=T310753.IIRS.FE                                 
INPUT1=ZQGSX07.                                         
STR = 'MARROYO@US.IMSHEALTH.COM'                       
                                                       
ADDRESS "TSO"                                           
  "ALLOC F(INDD) DS('"INPUT0"("INPUT1")') SHR REUSE"   
  "ALLOC F(OUTDD) DS('"INPUT0"("INPUT1")') SHR REUSE"   
  "EXECIO * DISKR  INDD  (FINIS STEM LINES."           
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Sun May 27, 2012 12:00 am
Reply with quote

alloc input
execio DISKR
free input

manipulate data

alloc output
execio DISKW
free ouput

do not alloc the same file twice without the intervening FREE.
Back to top
View user's profile Send private message
Srinivasarangam
Warnings : 1

New User


Joined: 01 Jun 2010
Posts: 39
Location: India

PostPosted: Sun May 27, 2012 12:13 am
Reply with quote

Ok I will change the code as suggested.
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Sun May 27, 2012 12:16 am
Reply with quote

Also ensure its PACK off while copy from one dataset to another and within the member profile
Back to top
View user's profile Send private message
Srinivasarangam
Warnings : 1

New User


Joined: 01 Jun 2010
Posts: 39
Location: India

PostPosted: Sun May 27, 2012 12:24 am
Reply with quote

Hi Pan,

Sure I will do that.

THe ISREDIT is working for me too after copying the MYMACRO to SYSEXEC library as you suggested. Thank you once again...

Thanks,
Srini.
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Sun May 27, 2012 12:28 am
Reply with quote

Glad its working icon_smile.gif

So now you could make things much better by using ISPF services to execute the macro against all the member of PDS or specific.
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 Goto page 1, 2  Next

 


Similar Topics
Topic Forum Replies
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts DELETE SPUFI DB2 1
No new posts DSNTIAUL driven delete IBM Tools 0
No new posts Search two or more word with FILEAID Compuware & Other Tools 15
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
Search our Forums:

Back to Top