Re: PIPE locate question

2011-01-06 Thread Berry van Sleeuwen
I was close but not quite correct. Here is the result after testing:

/* */
parse upper arg input  
 

'PIPE (END ?) CP QUERY NAMES',   /* Get UID's */
  '| SPLIT at str /,/',  /* split into lines  */
  '| LOCATE /- DSC/',/* Only disconnected */
  '| specs w1 1',/* get names */
  '| strip', /* remove blanks */
  '| sort 1-8',  /* sort  */
  '| pad 8', /* Make sure length 8*/
  '| a: lookup 1.8 1.8 master',  /* Compare   */
  '| count lines',   /* how many found*/
  '| var iffound',   /* number of names found */
  '? var input', /* names parsed from cmdline */
  '| split', /* split into lines  */
  '| pad 8', /* make sure length 8*/
  '| a:',/* into lookup   */
  '| hole',  /* drop names not in input   */
  '? a:',/* tert.  output unref   */
  '| cons',  /* display   */
  '| count lines',   /* How many not found*/
  '| var ifnotfound' /* number of names not found */

Regards, Berry.


Re: PIPE locate question

2011-01-05 Thread Berry van Sleeuwen
You can use lookup to process a list. I haven't tested this but
something like:

/* */
parse arg input
PIPE (END \) CP QUERY NAMES,
| SPLIT,
| LOCATE /- DSC/,
| sort 1-8,
| pad 8   /* Make sure length 8 */
| a: lookup 1.8 1.8,  /* Compare */
| count lines,
| var iffound,/* number of names found */
\ var input,  /* names parsed from commandline */
| split,
| pad 8,  /* make sure length 8 */
| a:,
| count lines,/* number of names not found */
| var ifnotfound

Regards, Berry.

Op 05-01-11 14:30, Sergio Lima schreef:
> Hello Kris,
>  
> Thanks very much, run very well, look please :
>  
>  3 *-* "PIPE CP QUERY NAMES | SPLIT , | STRIP | LOCATE /- DSC/ ","
> | SORT 1-
> 8 | > MACH DISC A"," | LOCATE /X/ | CONSOLE | COUNT LINES |VAR
> NBFOUND"
>>>>   "PIPE CP QUERY NAMES | SPLIT , | STRIP | LOCATE /- DSC/  
> | SORT 1-
> 8 | > MACH DISC A  | LOCATE /X/ | CONSOLE | COUNT LINES |VAR
> NBFOUND"  
>  6 *-* IF
> NBFOUND=0
>>>>  
> "1"   
>*-* 
> THEN   
>*-* 
> DO 
>  7 *-*   SAY 'NOTHING FOUND FOR
> X' 
>>>> "NOTHING FOUND FOR
> X"   
> NOTHING FOUND FOR
> X
>*-*   EXIT
> 67   
>>>>
> "67"
> 
>  
> So one more thing , if not slow you down, Do you have idea, how can I
> execute this same command to 8 cms machines ?
>  
> Better use a variable under LOCATE COMMAND , and do a loop 8 times ? ,
> or not ?
>  
> Thanks again Kris, about the PIPE COURSE, I already have download here
> in my machine, and, always that have time, i try learn more.
> This course is very good.
>  
> Best Regards,
>  
> Sergio
>  
> > Date: Wed, 5 Jan 2011 14:12:33 +0100
> > From: kris.buel...@gmail.com
> > Subject: Re: PIPE locate question
> > To: IBMVM@LISTSERV.UARK.EDU
> >
> > What about this:
> > "PIPE CP QUERY NAMES | SPLIT , | STRIP | LOCATE /- DSC/ ",
> > " | sort 1-8 | > mach disc a",
> > "|| locate /x/ | console | count lines |Var NbFound"
> > If NbFound=0 then do
> > say 'Nothing found for x' ; exit 67; end
> >
> > Remark that I made one big pipe of the 3 ones you used. There is no
> > need to work with intermediate files. And, maybe you don't need the
> > file at all, if so, you can remove
> > | > mach disc a
> > too.
> >
> > By the way, my LISTS package on the VM download library has a
> USERLIST EXEC:
> > USERLIST lists all users
> > USERLIST *xxx* lists all users with xxx in their name
> > It givs a FILELIST like interface.
> >
> > Kris Buelens
> >
> > 2011/1/5, Sergio Lima :
> > >
> > > Hello List,
> > >
> > > As I learned in this list, I'm trying to use PIPE in some cases
> instead
> > > REXX.
> > >
> > > Now, We need see from time to time, if some machines are running in
> > > disconnect mode.
> > >
> > > Then write this sample PIPE, that put in a file, all machines that
> is run in
> > > disconnect mode, and then try locate that We need.
> > >
> > > trace r
> > > "PIPE CP QUERY NAMES | SPLIT , | STRIP | LOCATE /- DSC/ | > mach
> disc a"
> > > "pipe < mach disc a | sort 1-8 | > mach disc a"
> > > "pipe < mach disc a | locate /x/ | console"
> > > say rc
> > > exit
> > >
> > > The problem, is that the RC (Return Code) always return 0, if the
> string
> > > exist or not.
> > >
> > > For example :
> > >
> > > My file :
> > >
> > > MACH DISC
> > > ===>
> > > CONNECT - DSC
> > > CPUVM - DSC
> > > DEFCICS - DSC
> > > DISKACNT - DSC
> > > FTPSERVE - DSC
> > > GCS - DSC
> > > LPSERVE - DSC
> > > OPERATOR - DSC
> > > OPERSYMP - DSC
> > > OP1 - DSC
> > > OP

Re: PIPE locate question

2011-01-05 Thread Alan Altmark
On Wednesday, 01/05/2011 at 07:45 EST, Sergio Lima 
 wrote:

> As I learned in this list, I'm trying to use PIPE in some cases instead 
REXX.
> :
> Looking in the Manual CMS PIPELINES REFERENCE, Can't see how get the 
Return 
> Code.

While you are getting good answers from Kris and others, let me explain 
that there was no error in your pipe, so there is no non-zero RC.  The 
locate stage will send to its primary output stream all records that 
contain the string.  If no records contain the string, no records are sent 
to the primary output stream.

This is why Kris suggested counting the number of records in the primary 
output stream.

Alan Altmark

z/VM and Linux on System z Consultant
IBM System Lab Services and Training 
ibm.com/systems/services/labservices 
office: 607.429.3323
alan_altm...@us.ibm.com
IBM Endicott


Re: PIPE locate question

2011-01-05 Thread Sergio Lima

Hello Kris,
 
Thanks very much, run very well, look please :
 
 3 *-* "PIPE CP QUERY NAMES | SPLIT , | STRIP | LOCATE /- DSC/ "," | SORT 1-
8 | > MACH DISC A"," | LOCATE /X/ | CONSOLE | COUNT LINES |VAR NBFOUND" 
   >>>   "PIPE CP QUERY NAMES | SPLIT , | STRIP | LOCATE /- DSC/   | SORT 1-
8 | > MACH DISC A  | LOCATE /X/ | CONSOLE | COUNT LINES |VAR NBFOUND"   
 6 *-* IF NBFOUND=0 
   >>>   "1"
   *-*  THEN
   *-*  DO  
 7 *-*   SAY 'NOTHING FOUND FOR X'  
   >>> "NOTHING FOUND FOR X"
NOTHING FOUND FOR X 
   *-*   EXIT 67
   >>> "67" 
 
 
So one more thing , if not slow you down, Do you have idea, how can I execute 
this same command to 8 cms machines ?
 
Better use a variable under LOCATE COMMAND , and do a loop 8 times ? , or not ?
 
Thanks again Kris, about the PIPE COURSE, I already have download here in my 
machine, and, always that have time, i try learn more.
This course is very good.
 
Best Regards,
 
Sergio
 
> Date: Wed, 5 Jan 2011 14:12:33 +0100
> From: kris.buel...@gmail.com
> Subject: Re: PIPE locate question
> To: IBMVM@LISTSERV.UARK.EDU
> 
> What about this:
> "PIPE CP QUERY NAMES | SPLIT , | STRIP | LOCATE /- DSC/ ",
> " | sort 1-8 | > mach disc a",
> "|| locate /x/ | console | count lines |Var NbFound"
> If NbFound=0 then do
> say 'Nothing found for x' ; exit 67; end
> 
> Remark that I made one big pipe of the 3 ones you used. There is no
> need to work with intermediate files. And, maybe you don't need the
> file at all, if so, you can remove
> | > mach disc a
> too.
> 
> By the way, my LISTS package on the VM download library has a USERLIST EXEC:
> USERLIST lists all users
> USERLIST *xxx* lists all users with xxx in their name
> It givs a FILELIST like interface.
> 
> Kris Buelens
> 
> 2011/1/5, Sergio Lima :
> >
> > Hello List,
> >
> > As I learned in this list, I'm trying to use PIPE in some cases instead
> > REXX.
> >
> > Now, We need see from time to time, if some machines are running in
> > disconnect mode.
> >
> > Then write this sample PIPE, that put in a file, all machines that is run in
> > disconnect mode, and then try locate that We need.
> >
> > trace r
> > "PIPE CP QUERY NAMES | SPLIT , | STRIP | LOCATE /- DSC/ | > mach disc a"
> > "pipe < mach disc a | sort 1-8 | > mach disc a"
> > "pipe < mach disc a | locate /x/ | console"
> > say rc
> > exit
> >
> > The problem, is that the RC (Return Code) always return 0, if the string
> > exist or not.
> >
> > For example :
> >
> > My file :
> >
> > MACH DISC
> > ===>
> > CONNECT - DSC
> > CPUVM - DSC
> > DEFCICS - DSC
> > DISKACNT - DSC
> > FTPSERVE - DSC
> > GCS - DSC
> > LPSERVE - DSC
> > OPERATOR - DSC
> > OPERSYMP - DSC
> > OP1 - DSC
> > OP2 - DSC
> > PERFSVM - DSC
> >
> > Running the EXEC :
> >
> > With NOT FOUND :
> >
> > 3 *-* "PIPE CP QUERY NAMES | SPLIT , | STRIP | LOCATE /- DSC/ | > mach
> > disc
> > a"
> >
> > >>> "PIPE CP QUERY NAMES | SPLIT , | STRIP | LOCATE /- DSC/ | >
> > mach di
> > sc a"
> >
> > 4 *-* "pipe < mach disc a | sort 1-8 | > mach disc a"
> >
> > >>> "pipe < mach disc a | sort 1-8 | > mach disc a"
> >
> > 5 *-* "pipe < mach disc a | locate /x/ | console"
> >
> > >>> "pipe < mach disc a | locate /x/ | console"
> >
> > 6 *-* say rc
> >
> > >>> "0"
> >
> > 0
> >
> > 7 *-* exit
> >
> >
> >
> > With FOUND :
> >
> > 3 *-* "PIPE CP QUERY NAMES | SPLIT , | STRIP | LOCATE /- DSC/ | > mach
> > dis
> > a"
> >
> > >>> "PIPE CP QUERY NAMES | SPLIT , | STRIP | LOCATE /- DSC/ | >
> > mach d
> > sc a"
> >
> > 4 *-* "pipe < mach disc a | sort 1-8 | > mach disc a"
> >
> > >>> "pipe < mach disc a | sort 1-8 | > mach disc a"
> >
> > 5 *-* "pipe < mach disc a | locate /CPUVM/ | console"
> >
> > >>> "pipe < mach disc a | locate /CPUVM/ | console"
> >
> > CPUVM - DSC
> >
> > 6 *-* say rc
> >
> > >>> "0"
> >
> > 0
> >
> > 7 *-* exit
> >
> >
> > Looking in the Manual CMS PIPELINES REFERENCE, Can't see how get the Return
> > Code.
> >
> > Please, someone can help us with this question?
> >
> > Thanks very much
> >
> > Sergio Lima Costa
> > Sao Paulo - Brazil 
> 
> 
> -- 
> Kris Buelens,
> IBM Belgium, VM customer support
  

Re: PIPE locate question

2011-01-05 Thread Frank M. Ramaekers
Maybe this example will help (QN EXEC):

/*   QUERY NAMES replacement
*/

  Trace "O"


  Address "COMMAND"


  "PIPE (endchar ?)",


  "|  CP QUERY NAMES",


  "|  ZONE 9.1 NFIND -"||,


  "|  SPLIT ,",


  "|  STRIP",


  "|o:FANOUT",


  "|  SORT",


  "|  SPEC 1.15 1.16",


  "|  SNAKE 5",


  "|i:FANIN",


  "|  CONSOLE",


"?o:",


  "|  COUNT LINES",


  "|  SPEC /  Total number of users = / 1 1-* NW",


  "|j:FANIN",


  "|  JOIN *",


  "|i:",


"?o:",


  "|  SPEC FS - F2 STRIP 1",


  "|p:FIND DSC"||,


  "|  COUNT LINES",


  "|  SPEC /  disconnected = / 1 1-* NW", 

  "|  j:" 

Exit rc   

 

 

Frank M. Ramaekers Jr.

 

 



From: The IBM z/VM Operating System [mailto:ib...@listserv.uark.edu] On
Behalf Of Sergio Lima
Sent: Wednesday, January 05, 2011 6:45 AM
To: IBMVM@LISTSERV.UARK.EDU
Subject: PIPE locate question

 

Hello List,
 
As I learned in this list, I'm trying to use PIPE in some cases instead
REXX.
 
Now, We need see from time to time, if some machines are running in
disconnect mode.
 
Then write this sample PIPE, that put in a file, all machines that is
run in disconnect mode, and then try locate that We need.
 
trace r

"PIPE CP QUERY NAMES | SPLIT , | STRIP | LOCATE /- DSC/ | > mach disc a"

"pipe < mach disc a | sort 1-8 | > mach disc a"

"pipe < mach disc a | locate /x/ | console"

say rc

exit

 
The problem, is that the RC (Return Code) always return 0, if the string
exist or not.
 
For example :
 
My file :
 
 MACH DISC
 ===> 
CONNECT  - DSC
CPUVM- DSC
DEFCICS  - DSC
DISKACNT - DSC
FTPSERVE - DSC
GCS  - DSC
LPSERVE  - DSC
OPERATOR - DSC
OPERSYMP - DSC
OP1  - DSC
OP2  - DSC
PERFSVM  - DSC
 
Running the EXEC :
 
With NOT FOUND :
 
 3 *-* "PIPE CP QUERY NAMES | SPLIT , | STRIP | LOCATE /- DSC/ | >
mach disc
 a"

   >>>   "PIPE CP QUERY NAMES | SPLIT , | STRIP | LOCATE /- DSC/ | >
mach di
sc a"

 4 *-* "pipe < mach disc a | sort 1-8 | > mach disc a"

   >>>   "pipe < mach disc a | sort 1-8 | > mach disc a"

 5 *-* "pipe < mach disc a | locate /x/ | console"

   >>>   "pipe < mach disc a | locate /x/ | console"

 6 *-* say rc

   >>>   "0"

0

 7 *-* exit

 
 
With FOUND :
 
 3 *-* "PIPE CP QUERY NAMES | SPLIT , | STRIP | LOCATE /- DSC/ | >
mach dis
 a"

   >>>   "PIPE CP QUERY NAMES | SPLIT , | STRIP | LOCATE /- DSC/ | >
mach d
sc a"

 4 *-* "pipe < mach disc a | sort 1-8 | > mach disc a"

   >>>   "pipe < mach disc a | sort 1-8 | > mach disc a"

 5 *-* "pipe < mach disc a | locate /CPUVM/ | console"

   >>>   "pipe < mach disc a | locate /CPUVM/ | console"

CPUVM- DSC

 6 *-* say rc

   >>>   "0"

0

 7 *-* exit

 
Looking in the Manual CMS PIPELINES REFERENCE, Can't see how get the
Return Code.
 
Please, someone can help us with this question?
 
Thanks very much
 
Sergio Lima Costa
Sao Paulo - Brazil


_
This message contains information which is privileged and confidential and is 
solely for the use of the
intended recipient. If you are not the intended recipient, be aware that any 
review, disclosure,
copying, distribution, or use of the contents of this message is strictly 
prohibited. If you have
received this in error, please destroy it immediately and notify us at 
privacy...@ailife.com.


Re: PIPE locate question

2011-01-05 Thread Kris Buelens
What about this:
"PIPE CP QUERY NAMES | SPLIT , | STRIP | LOCATE /- DSC/ ",
   " | sort 1-8 | > mach disc a",
   "|| locate /x/ | console | count lines |Var NbFound"
If NbFound=0 then do
   say 'Nothing found for x' ; exit 67; end

Remark that I made one big pipe of the 3 ones you used.  There is no
need to work with intermediate files.  And, maybe you don't need the
file at all, if so, you can remove
   | > mach disc a
too.

By the way, my LISTS package on the VM download library has a USERLIST EXEC:
  USERLIST lists all users
  USERLIST *xxx*lists all users with xxx in their name
It givs a FILELIST like interface.

Kris Buelens

2011/1/5, Sergio Lima :
>
> Hello List,
>
> As I learned in this list, I'm trying to use PIPE in some cases instead
> REXX.
>
> Now, We need see from time to time, if some machines are running in
> disconnect mode.
>
> Then write this sample PIPE, that put in a file, all machines that is run in
> disconnect mode, and then try locate that We need.
>
> trace r
> "PIPE CP QUERY NAMES | SPLIT , | STRIP | LOCATE /- DSC/ | > mach disc a"
> "pipe < mach disc a | sort 1-8 | > mach disc a"
> "pipe < mach disc a | locate /x/ | console"
> say rc
> exit
>
> The problem, is that the RC (Return Code) always return 0, if the string
> exist or not.
>
> For example :
>
> My file :
>
>  MACH DISC
>  ===>
> CONNECT  - DSC
> CPUVM- DSC
> DEFCICS  - DSC
> DISKACNT - DSC
> FTPSERVE - DSC
> GCS  - DSC
> LPSERVE  - DSC
> OPERATOR - DSC
> OPERSYMP - DSC
> OP1  - DSC
> OP2  - DSC
> PERFSVM  - DSC
>
> Running the EXEC :
>
> With NOT FOUND :
>
>  3 *-* "PIPE CP QUERY NAMES | SPLIT , | STRIP | LOCATE /- DSC/ | > mach
> disc
>  a"
>
>>>>   "PIPE CP QUERY NAMES | SPLIT , | STRIP | LOCATE /- DSC/ | >
> mach di
> sc a"
>
>  4 *-* "pipe < mach disc a | sort 1-8 | > mach disc a"
>
>>>>   "pipe < mach disc a | sort 1-8 | > mach disc a"
>
>  5 *-* "pipe < mach disc a | locate /x/ | console"
>
>>>>   "pipe < mach disc a | locate /x/ | console"
>
>  6 *-* say rc
>
>>>>   "0"
>
> 0
>
>  7 *-* exit
>
>
>
> With FOUND :
>
>  3 *-* "PIPE CP QUERY NAMES | SPLIT , | STRIP | LOCATE /- DSC/ | > mach
> dis
>  a"
>
>>>>   "PIPE CP QUERY NAMES | SPLIT , | STRIP | LOCATE /- DSC/ | >
> mach d
> sc a"
>
>  4 *-* "pipe < mach disc a | sort 1-8 | > mach disc a"
>
>>>>   "pipe < mach disc a | sort 1-8 | > mach disc a"
>
>  5 *-* "pipe < mach disc a | locate /CPUVM/ | console"
>
>>>>   "pipe < mach disc a | locate /CPUVM/ | console"
>
> CPUVM- DSC
>
>  6 *-* say rc
>
>>>>   "0"
>
> 0
>
>  7 *-* exit
>
>
> Looking in the Manual CMS PIPELINES REFERENCE, Can't see how get the Return
> Code.
>
> Please, someone can help us with this question?
>
> Thanks very much
>
> Sergio Lima Costa
> Sao Paulo - Brazil


-- 
Kris Buelens,
IBM Belgium, VM customer support


PIPE locate question

2011-01-05 Thread Sergio Lima

Hello List,
 
As I learned in this list, I'm trying to use PIPE in some cases instead REXX.
 
Now, We need see from time to time, if some machines are running in disconnect 
mode.
 
Then write this sample PIPE, that put in a file, all machines that is run in 
disconnect mode, and then try locate that We need.
 
trace r   
"PIPE CP QUERY NAMES | SPLIT , | STRIP | LOCATE /- DSC/ | > mach disc a"  
"pipe < mach disc a | sort 1-8 | > mach disc a"   
"pipe < mach disc a | locate /x/ | console"   
say rc
exit  
 
The problem, is that the RC (Return Code) always return 0, if the string exist 
or not.
 
For example :
 
My file :
 
 MACH DISC
 ===> 
CONNECT  - DSC
CPUVM- DSC
DEFCICS  - DSC
DISKACNT - DSC
FTPSERVE - DSC
GCS  - DSC
LPSERVE  - DSC
OPERATOR - DSC
OPERSYMP - DSC
OP1  - DSC
OP2  - DSC
PERFSVM  - DSC
 
Running the EXEC :
 
With NOT FOUND :
 
 3 *-* "PIPE CP QUERY NAMES | SPLIT , | STRIP | LOCATE /- DSC/ | > mach disc
 a" 
   >>>   "PIPE CP QUERY NAMES | SPLIT , | STRIP | LOCATE /- DSC/ | > mach di
sc a"   
 4 *-* "pipe < mach disc a | sort 1-8 | > mach disc a"  
   >>>   "pipe < mach disc a | sort 1-8 | > mach disc a"
 5 *-* "pipe < mach disc a | locate /x/ | console"  
   >>>   "pipe < mach disc a | locate /x/ | console"
 6 *-* say rc   
   >>>   "0"
0   
 7 *-* exit 
 
 
With FOUND :
 
 3 *-* "PIPE CP QUERY NAMES | SPLIT , | STRIP | LOCATE /- DSC/ | > mach dis
 a"
   >>>   "PIPE CP QUERY NAMES | SPLIT , | STRIP | LOCATE /- DSC/ | > mach d
sc a"  
 4 *-* "pipe < mach disc a | sort 1-8 | > mach disc a" 
   >>>   "pipe < mach disc a | sort 1-8 | > mach disc a"   
 5 *-* "pipe < mach disc a | locate /CPUVM/ | console" 
   >>>   "pipe < mach disc a | locate /CPUVM/ | console"   
CPUVM- DSC 
 6 *-* say rc  
   >>>   "0"   
0  
 7 *-* exit
 
Looking in the Manual CMS PIPELINES REFERENCE, Can't see how get the Return 
Code.
 
Please, someone can help us with this question?
 
Thanks very much
 
Sergio Lima Costa
Sao Paulo - Brazil