Page 1 of 1

String Search and alert if found

PostPosted: Wed Apr 04, 2018 8:35 pm
by golemis
Hi,

My question may sound naive, but I have coded the following search commands:
OPTION COPY
   OUTFIL FNAMES=SORTOUT,INCLUDE=(1,80,SS,EQ,C'*UNMATCHED  '),
   NULLOFL=RC4
 

And when the file contains "*UNMATCHED " then I get a RC0, while if it doesn't, I get a RC4.

In fact I need the other way around, RC4 if string is found, RC0 if not.

I have tried both NE instead of EQ, and OMIT instead of INCLUDE, but no difference.

Any ideas ? Thanks in advance,
George

Re: String Search and alert if found

PostPosted: Wed Apr 04, 2018 9:15 pm
by enrico-sorichetti
why not try with exclude ???

Re: String Search and alert if found

PostPosted: Wed Apr 04, 2018 9:21 pm
by golemis
Hi, Enrico, not quite what the EXCLUDE is. I also tried :
OPTION COPY
OUTFIL FNAMES=SORTOUT,OMIT=(1,80,SS,EQ,C'*UNMATCHED  ')
OUTFIL FNAMES=SORTOUT1,SAVE,NULLOFL=RC4

but again I get RC4 and RC0 the other way around from what I need

Re: String Search and alert if found

PostPosted: Wed Apr 04, 2018 9:29 pm
by enrico-sorichetti
oops... sorry I had looked only at the code and not at the test history

Re: String Search and alert if found

PostPosted: Wed Apr 04, 2018 10:03 pm
by golemis
I also tried:
//SEARCH  EXEC PGM=ISRSUPC,
//            PARM=(SRCHCMP,
//            'ANYC')
//NEWDD  DD DSN=MY.FILE,
//          DISP=SHR
//OUTDD  DD SYSOUT=(A)
//SYSIN  DD *
SRCHFOR  '*UNMATCHED'
/*

which comes closer to what I need, but gives RC1 in case of FOUND, not RC4

George

Re: String Search and alert if found

PostPosted: Thu Apr 05, 2018 11:21 am
by expat
Why do you need the RC to be reversed ?
Surely you can accommodate an RC4 by either COND= or IF / ELSE logic

Re: String Search and alert if found

PostPosted: Thu Apr 05, 2018 12:39 pm
by golemis
Thank you expat, I had thought of it, but it won't do.

I need to intercept this new job in an existing OPC (Tivoli TWS) stream of jobs, so that it will stop the flow in case of "unexpected" records are identified. Therefore the RC0 should be in case of NOT FOUND, while RC>=4 should be in case of FOUND. If I would have to play with IF / ELSE /ENDIF I would have to build extra steps to set the RC as required. Instead I would have built a simple REXX exec to scan the file and set the RC's as required. But I find REXX interpreter an overkill for such simple case, while though that SEARCH and SORT would simplify this. But obviously they cannot.

Don't ask me why I do not set the RC's in the report generation routine, the report is generated on another node (Unix) and transferred to us by Connect Direct. Not the perfect design ... , I tend to agree, but it is now beyond our roles.

Thanks once again,

George

Re: String Search and alert if found

PostPosted: Thu Apr 05, 2018 2:34 pm
by golemis
Finally worked with:

//PDC262S1 EXEC PGM=ISRSUPC,
//         PARM=(SRCHCMP,
//         'ANYC')
//NEWDD    DD DISP=SHR,DSN=MY.FILE
//OUTDD    DD SYSOUT=*
//SYSIN    DD *
  SRCHFOR  '*UNMATCHED  '
/*
// IF RC EQ 1 THEN
//PDC262S2 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN    DD *
  SET MAXCC=4
  SET LASTCC=4
/*
// ENDIF

Re: String Search and alert if found

PostPosted: Thu Apr 05, 2018 4:35 pm
by expat
WHY do you need to CHANGE the RC ???

If the RC is zero do this, if not do that
Simple logic

//TEST     IF STEP.RC = 0 THEN
Some JCL code
//         ELSE
Other JCL code
//         ENDIF
 


But then what do I know after only 40+ years in the business

But well done on finding an alternative solution.