Using REXX to find word

55 pts.
REXX Mainframe
Using a rexx, I need to find some words in a job batch and send a message for the user when found them.

Software/Hardware used:
z/os 01.13 ISPF

Answer Wiki

Thanks. We'll let you know when a new response is added.

Read in the PDS member and use the POS function to find the position of the word you are looking for. There are other variations on this command too like LASTPOS for the last position the word is found in the line and FIRSTPOS for the first position found.


X = POS(‘string’,variable) where string is the word you are looking for and variable is the variable you are searching in.

Discuss This Question: 6  Replies

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • TomLiotta
    Using a rexx, I need to find some words ... and send a message...   Why must you use REXX? Where will you look to "find some words"? How will you "send a message"? (I.e., what messaging interface will you use?) Finally, what is your problem in doing this? Do you need someone to write the whole REXX program for you?   Tom
    125,585 pointsBadges:
  • violeta1
    My rexx has the name @CHKDB2.For the message i will use the "Adress TSO" with "send" to the "user id".For the "words i want to find" it happens like this: 1st. A job runs and call a rexx proclib (pgm=ikjeft01,parm='@chkdb2 &member(1,8, ) 6subsys(1,8,)' 2nd after the rexx find the forbidden words in the dd IN1 of the job will send a message to the userid.I have a very old rexx, to much complex and not adequated to this propose. is it possible give any example?
    55 pointsBadges:
  • TomLiotta
    I have a very old rexx, to much complex and not adequated to this propose.   Can you share it with us or show us any attempts you've made? If an existing proc is 'too complex', it might imply that there are elements that need attention that we are not aware of.   Tom
    125,585 pointsBadges:
  • violeta1

            When some user submit a job (and this one is a example which forbidden words are DB2A, DBSB and DB2D)…

    //!JOBSISCAJCL06 JOB ,'TESTE @CHKDB2',                       

    //         MSGLEVEL=(1,1),                                   

    //         MSGCLASS=X,                                       

    //         CLASS=!CLASSE4,                                   

    //         NOTIFY=PRDVCF                                     


    //LIBSRCH  JCLLIB ORDER=!JPRCLIB                             

    //*        JCLLIB ORDER=!TESTE                               

    //         INCLUDE MEMBER=$BATCH                             

    //         INCLUDE MEMBER=$TCPIP                             


    //STEP01   EXEC PGM=PSUBJOB                                  


    //JOBOUT   DD SYSOUT=(2,INTRDR)                              

    //SYSIN    DD *                                              

    #01.    DB2A                                                 

    #02.    DBSB                                                 

    #03.    DB2D                                                 


            …is calling this step in other process (not important in this matter)…


    //CHKJCL1   EXEC PGM=IKJEFT01,                                

    //            PARM='@CHKDB2 &MEMBER(1,8, ) &SUBSYS(1,8,)'     


    //SYSTSPRT  DD SYSOUT=*                                       

    //SYSTSIN   DD DUMMY                                          

    //IN1       DD DISP=(OLD,PASS),DSN=&&ELMOUT                   




            …and the rexx code I made.

    000001 /* Rexx @CHKDB2                                                      */


    000003 signal on syntax                          /* trap rexx syntax errors */

    000004 signal off novalue                    /* trap unititalized variables */

    000005 signal on  error      /* handle positive rc command failures in code */

    000006 signal on  failure    /* handle negative rc command failures in code */

    000007 signal on  halt                    /* allow normal hi/he termination */



    000010 Call Main_Routine                                                      

    000011 Return                                                                  

    000012 Main_Routine:                                                          

    000013 return_code = 0                                                        

    000014 Call Valida_Input                                                      

    000015 Call ini_vars                                                          

    000016 Call Valida_Env                                                        

    000017 Call alloc_files in1 f1                                                 

    000018 say in1 & say in2                                                      


    000020 Call alloc_files_pds in2 f2   


    000022 "EXECIO * DISKR f2 (STEM tabclass. FINIS"                              

    000023 if rc <> 0 then                                                        

    000024 do                                                                      

    000025   say 'Erro na leitura do ficheiro de input: 'f2                       

    000026   return_code = 16                                                     

    000027   Call exit                                                            

    000028 end                                                                    

    000029 if tabclass.0 = 0 then                                                 

    000030 do                                                                      

    000031   say 'Ficheiro de input vazio:  'f2                                   

    000032   return_code = 16                                                     

    000033   exit 4                                                                

    000034 end                                                                    


    000036 mylist="'DB2A ' DB2B ' DB2D '"                                          

    000037 drop (mylist) find                                                     

    000038  exit                                                                                                          



    My Rexx experience is in a very low level (as all you noticed!...)

    I just had a beginner course two months ago for the first time and now I have this work to finish.

    And I really want to make it.

    Will you help me?

    Many thanks.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.


Share this item with your network: