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
 

 

Using REXX to find word in a job batch

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
vasco ferreira

New User


Joined: 12 Jul 2008
Posts: 32
Location: sintra - portugal

PostPosted: Thu Oct 04, 2012 4:38 pm    Post subject: Using REXX to find word in a job batch
Reply with quote

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

My rexx has the name @CHKDB2.
For the message i will use the “Address 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?
Many thanks.
Back to top
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Thu Oct 04, 2012 5:45 pm    Post subject: Reply to: Using REXX to find word in a job batch
Reply with quote

Quote:
I need to find some words in a job batch


You posted only irrelevant details ( who cares about the REXX script name ? ) ...

take a deep breath and rewrite clearly the requirement


why rexx ??? why a message ???
there are zillions of reason for which the message can be lost
the user not logged on, or even a tso profile setting to prevent reciving messages

on the other side there are quite a few examples on how to do it using sort and emailing

what prevents the luser to look at the job output him/herself ?
Back to top
View user's profile Send private message
vasco ferreira

New User


Joined: 12 Jul 2008
Posts: 32
Location: sintra - portugal

PostPosted: Thu Oct 04, 2012 7:23 pm    Post subject:
Reply with quote

This procedure must be regulated by a distintc software (Endeavor). And that's the reason for use rexx. The option emailing is always good (thanks), but my major concern is with the code of the searching words. Could you show me same examples, please? Thank you.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Thu Oct 04, 2012 7:39 pm    Post subject:
Reply with quote

vasco ferreira wrote:
Could you show me same examples, please? Thank you.

First tell us what your system management product is: SDSF, IOF, (E)JES, Mk I eyeball on dead-tree listings...?
Back to top
View user's profile Send private message
vasco ferreira

New User


Joined: 12 Jul 2008
Posts: 32
Location: sintra - portugal

PostPosted: Thu Oct 04, 2012 8:10 pm    Post subject:
Reply with quote

It's Z/OS rel 01.13 using ISPF (and SDSF)
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Thu Oct 04, 2012 8:19 pm    Post subject: Reply to: Using REXX to find word in a job batch
Reply with quote

You still have not told anything useful!

let' s ask it like a quiz

(1)
some jcl/job ..... created some dataset
You want to check if the incriminated dataset contains some <string>
and in case notify somebody
( could be a subsequent step in the same jcl/job or a <successor> job,
does little difference)

(2)
some jcl/job was run
You want to scan from a different jcl the JES <output> of the <previous/above mentioned> jcl/job
... ... ...

(3)
some jcl/job is running
You want to scan from <inside> the running jcl/job JES <output> for the running job
... ... ...

please reply 1/2/3

getting info is like pulling a tooth,
the dentist gets paid for it
we do it on our time and free of charge

icon_evil.gif
Back to top
View user's profile Send private message
David Robinson

Active User


Joined: 21 Dec 2011
Posts: 175
Location: UK

PostPosted: Thu Oct 04, 2012 8:26 pm    Post subject:
Reply with quote

I assume it's option 1 as the OP mentions a DDname IN1.

So, the Rexx is in the same batch job, and reads the dataset to see if some words exist? Seems easy enough.

Have you tried SUBSTR or INDEX for example?
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Thu Oct 04, 2012 8:32 pm    Post subject: Reply to: Using REXX to find word in a job batch
Reply with quote

in any case the TS might find useful to meditate on the entropy of the initial post icon_cool.gif
Back to top
View user's profile Send private message
vasco ferreira

New User


Joined: 12 Jul 2008
Posts: 32
Location: sintra - portugal

PostPosted: Thu Oct 04, 2012 9:11 pm    Post subject:
Reply with quote

Yes is option 1. Thanks
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1715
Location: UK

PostPosted: Thu Oct 04, 2012 9:18 pm    Post subject:
Reply with quote

Isn't INDEX deprectaed and POS preferred? Or is it the other way round? icon_question.gif
But read that datset line-by-line. Check each lien (using POS or INDEX) for the string, raise a flag (perhaps store the line no in a stem). At end, if stem.0 > 0 write out the message or whatever. Next step send the message (could do it via internal reader in previous step but I am simple and like to keep things simple).
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Thu Oct 04, 2012 9:20 pm    Post subject:
Reply with quote

vasco ferreira wrote:
Yes is option 1. Thanks

You want to check if a data set created in a previous step contains a certain token?

icon_eek.gif

Seriously, on the face of it this is a very trivial task, one that I would assign to a junior programmer with confidence that heesh would finish it in a day or two. Are there complexities that you are concealing from us, or are you truly incapable of writing this script?
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: Thu Oct 04, 2012 10:16 pm    Post subject:
Reply with quote

Hello,

I suspect that the first time thru is a bit daunting . . . icon_wink.gif
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Thu Oct 04, 2012 10:32 pm    Post subject: Reply to: Using REXX to find word in a job batch
Reply with quote

IMO the most effective solution would be a TWO step approach

ISRSUPC with the
FMSTOP ==> stop at first match

it will end with a RC 1 for a match RC 0 if nothing is found

and a second step to send whatever

Code:
 ****** ***************************** Top of Data ******************************
 000002 //SEARCH  EXEC PGM=ISRSUPC,                                           *
 000003 //            PARM=(SRCHCMP,
 000004 //            'FMSTOP')
 000005 //NEWDD  DD DSN=Your dataset,
 000006 //          DISP=the appropriate disp
 000007 //OUTDD  DD SYSOUT=(*)
 000008 //SYSIN  DD *
 000009 SRCHFOR  'the string'
 000010 /*
 ****** **************************** Bottom of Data ****************************
Back to top
View user's profile Send private message
vasco ferreira

New User


Joined: 12 Jul 2008
Posts: 32
Location: sintra - portugal

PostPosted: Mon Oct 08, 2012 3:24 pm    Post subject:
Reply with quote

1º 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
//JOBIN DD DISP=SHR,DSN=NDVRCER.CER.JCL.FTS01.PT(VASCO)
//JOBOUT DD SYSOUT=(2,INTRDR)
//SYSIN DD *
#01. DB2A
#02. DBSB
#03. DB2D

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

//*************************************************************
//CHKJCL1 EXEC PGM=IKJEFT01,
// PARM='@CHKDB2 &MEMBER(1,8, ) &SUBSYS(1,8,)'
//SYSEXEC DD DISP=SHR,DSN=NDVRDES.DES.JCL.PRCLIB01.PT
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD DUMMY
//IN1 DD DISP=(OLD,PASS),DSN=&&ELMOUT
//IN2 DD DISP=SHR,DSN=NDVRDES.DES.FILE.CNTL01.PT
//*

3º …and the rexx code I made.
000001 /* Rexx @CHKDB2 */
000002
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 */
000008
000009
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
000019
000020 Call alloc_files_pds in2 f2
000021
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
000035
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.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Mon Oct 08, 2012 3:57 pm    Post subject: Reply to: Using REXX to find word in a job batch
Reply with quote

Quote:
This procedure must be regulated by a distintc software (Endeavor). And that's the reason for use rexx.

utter horse manure

when defining the solution for a requirement a check is usually made to see if the required resources are available
and those include the SKILLS

the choice of using REXX without the appropriate skills is just plain inconsiderate

You will find little simpathy/code here ( it should be custom written for Your requirement ),
I provided You with a sound alternative to a clumsy rexx
why do You refuse to take it into consideration ? icon_evil.gif

You can use as many SRCHFOR clauses for as many <strings> you need to look for
Back to top
View user's profile Send private message
vasco ferreira

New User


Joined: 12 Jul 2008
Posts: 32
Location: sintra - portugal

PostPosted: Tue Oct 09, 2012 8:27 pm    Post subject:
Reply with quote

I'm taking it into consideration, Enrico. Thank you.
The problem is: this is a small part of a existing process wich includes a job and a rexx and i have to include this part because there are some colleagues working in the same. Thanks for your help.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Wed Oct 10, 2012 12:55 am    Post subject:
Reply with quote

I will presume that the code that you show is but a skeleton, as there isno hope of its actually running. I strongly recommend that you transfer this problem to our sister forum, as you admittedly a beginner in Rexx, and will likely find more suitable help there.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Wed Oct 10, 2012 2:17 am    Post subject: Reply to: Using REXX to find word in a job batch
Reply with quote

Quote:
The problem is: this is a small part of a existing process wich includes a job and a rexx and i have to include this part because there are some colleagues working in the same.

utter nonsense icon_cool.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 Oct 10, 2012 2:25 am    Post subject:
Reply with quote

Hello,

It may be getting to the point where this topic will not become productive (again?).

@vasco
Please explain why the SUPERC suggestion from Enrico cannot be used?

Why is REXX demanded? I would hope the goal was to get the correct "solutioin" rather than get hung up on the method?
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 -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How does a called pgm know if its cal... Graeme Westerman COBOL Programming 4 Tue Nov 29, 2016 9:25 pm
No new posts How to find the first monday of the w... abdulrafi COBOL Programming 10 Fri Nov 25, 2016 3:24 pm
No new posts What is the command to check MODE of ... rohanthengal CLIST & REXX 6 Fri Nov 18, 2016 1:48 pm
This topic is locked: you cannot edit posts or make replies. MIPS reduction for Batch job Virendra Shambharkar All Other Mainframe Topics 8 Mon Nov 07, 2016 4:02 pm
This topic is locked: you cannot edit posts or make replies. Rexx to create GDG by scanning JJ result krish.deepu CLIST & REXX 5 Tue Oct 25, 2016 5:32 pm


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