String Search and alert if found



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

String Search and alert if found

Postby golemis » Wed Apr 04, 2018 8:35 pm

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
golemis
 
Posts: 34
Joined: Wed Apr 04, 2018 8:13 pm
Location: London, UK
Has thanked: 10 times
Been thanked: 0 time

Re: String Search and alert if found

Postby enrico-sorichetti » Wed Apr 04, 2018 9:15 pm

why not try with exclude ???
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2994
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times

Re: String Search and alert if found

Postby golemis » Wed Apr 04, 2018 9:21 pm

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
golemis
 
Posts: 34
Joined: Wed Apr 04, 2018 8:13 pm
Location: London, UK
Has thanked: 10 times
Been thanked: 0 time

Re: String Search and alert if found

Postby enrico-sorichetti » Wed Apr 04, 2018 9:29 pm

oops... sorry I had looked only at the code and not at the test history
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2994
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times

Re: String Search and alert if found

Postby golemis » Wed Apr 04, 2018 10:03 pm

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
golemis
 
Posts: 34
Joined: Wed Apr 04, 2018 8:13 pm
Location: London, UK
Has thanked: 10 times
Been thanked: 0 time

Re: String Search and alert if found

Postby expat » Thu Apr 05, 2018 11:21 am

Why do you need the RC to be reversed ?
Surely you can accommodate an RC4 by either COND= or IF / ELSE logic

These users thanked the author expat for the post:
golemis (Thu Apr 05, 2018 11:41 am)
expat
 
Posts: 459
Joined: Sat Jun 09, 2007 3:21 pm
Has thanked: 0 time
Been thanked: 8 times

Re: String Search and alert if found

Postby golemis » Thu Apr 05, 2018 12:39 pm

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
golemis
 
Posts: 34
Joined: Wed Apr 04, 2018 8:13 pm
Location: London, UK
Has thanked: 10 times
Been thanked: 0 time

Re: String Search and alert if found

Postby golemis » Thu Apr 05, 2018 2:34 pm

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
golemis
 
Posts: 34
Joined: Wed Apr 04, 2018 8:13 pm
Location: London, UK
Has thanked: 10 times
Been thanked: 0 time

Re: String Search and alert if found

Postby expat » Thu Apr 05, 2018 4:35 pm

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.
expat
 
Posts: 459
Joined: Sat Jun 09, 2007 3:21 pm
Has thanked: 0 time
Been thanked: 8 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post