It's been ages since I've written any PIPEs code, but I believe this can be 
accomplished by Spec'ing a RECNUM (or is it RECNO?) somewhere in the records,  
perhaps at the front, before doing the locate stage, which should be changed to 
ignore the record number (like "locate w2-* "string), and then output the 
records WITH the recnum attached....

Joe

________________________________
From: CMSTSO Pipelines Discussion List <[email protected]> on behalf 
of Tim Joyce <[email protected]>
Sent: Monday, February 4, 2019 10:16 AM
To: [email protected]
Subject: How to output line number of locate

Hey Guys,



I'm not a skilled plumber. I'm much more familiar with CMS REXX. Many years ago 
I created a FINDIT EXEC REXX program in CMS that programmers use often to 
search CMS members for a specified string. I later migrated to use Pipelines 
I/O rather than EXECIO as pipelines is much more storage friendly. Here is a 
sample of the locate and specs used for output:



'<' fn ft fm,             /* Input file                  */

'| casei locate ~'strg'~',      /* Locate the string           */

'| specs ~'inrec'~ 1 1-130 25',  /* File info                   */

'| >> FINDIT OUTPUT A '    /* Put results in file         */



Sample output :



  Searched '* JCL C' for 'PGM=FTP'  Ignore Case



                        
00000000011111111112222222222333333333344444444445555555555666666666677777777778

   Files Found          
12345678901234567890123456789012345678901234567890123456789012345678901234567890

---------------------  
--------------------------------------------------------------------------------

CIGL1000 JCL      C1    // EXEC PGM=FTP,SIZE=(FTP,256K),PARM='IP=FPRD'

CIGL1005 JCL      C1    // EXEC PGM=FTP,SIZE=(FTP,256K),PARM='IP=GLPROD'

CIGL1021 JCL      C1    // EXEC PGM=FTP,SIZE=(FTP,256K),PARM='IP=IFHHICK'



It has been requested that I also output the line/record number that the string 
was found on (as some members locate strings in multiple locations). I have 
been looking through pipelines reference but have not figured out the best way 
to do this without a lot of additional preprocessing of input data. Any 
suggestions would be appreciated.



Tim Joyce

Alex Lee Inc.

Systems Administrator

Reply via email to