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
 

 

searching multiple strings in consecutive lines

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Amb

New User


Joined: 12 Mar 2010
Posts: 64
Location: India

PostPosted: Fri Jul 15, 2011 6:42 pm    Post subject: searching multiple strings in consecutive lines
Reply with quote

I have a PS file. It has around 200,000 lines of data.
I need to search for the lines which have the below strings in the same sequence as mentioned below.

N8USD210
MOBI
FLI10=PRR.

Basically I want to search the above strings on consecutive lines.

ie. N8USD210 should be present in the first line
MOBI should be present in the second line
FLI10=PRR. should be present in the third line

When I get the above mentioned strings at any position in three consecutive lines, I want to copy these three lines into another file.

To illustrate an example:

Input file:

Code:

//END OF DATA
//****************************************************
//STEP05   EXEC N8USD210,                               
//         MOBZ=MOBI001,                         
//         FLI10=PRR.A000T00.RRD0200A.GLREPT(+1)     
L01    XXRRPTOMOB  PROC MOBIUSXX=MOBIUSXX             
L01    XX*********************************************
L01    XX*----- LOAD DATASET TO MOBIUS               
L01    XX*********************************************
L01    XXSTEP010  EXEC PGM=IEBGENER                   
//*                                                   
//**************   END OF JCL RRD0200A   *************
L01    XXSYSPRINT DD DUMMY                           
L01    XXSYSIN    DD DUMMY                           
L01    XXSYSUT1   DD DISP=SHR,DSN=&FLI10             



Output file:

Code:
 
//STEP05   EXEC N8USD210,                               
//         MOBZ=MOBI001,                         
//         FLI10=PRR.A000T00.RRD0200A.GLREPT(+1)
Back to top
View user's profile Send private message

vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1504
Location: Chennai

PostPosted: Fri Jul 15, 2011 8:19 pm    Post subject:
Reply with quote

Hello,
You could try the below job,

Code:
//JS010    EXEC PGM=ICETOOL                                     
//TOOLMSG  DD SYSOUT=*                                         
//DFSMSG   DD SYSOUT=*                                         
//IN       DD DISP=SHR,DSN=WELLS.SORTIN                       
//OUT      DD DISP=OLD,DSN=WELLS.SORTOUT                     
//SYSOUT   DD SYSOUT=*                                         
//TOOLIN   DD *                                                 
  SPLICE FROM(IN) TO(OUT) ON(241,8,ZD) KEEPNODUPS WITHEACH -   
  WITH(81,80) WITH(161,80) -                                   
  USING(CTL1)                                                   
/*                                                             
//CTL1CNTL DD *                                                 
  OPTION COPY,NOSZERO                                           
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,80,SS,EQ,C'N8USD210'),     
  RECORDS=3,PUSH=(241:ID=8,249:SEQ=2)),                         
  IFTHEN=(WHEN=(249,2,ZD,EQ,2),OVERLAY=(81:1,80)),             
  IFTHEN=(WHEN=(249,2,ZD,EQ,3),OVERLAY=(161:1,80))             
  OUTFIL IFOUTLEN=80,INCLUDE=(1,80,SS,EQ,C'N8USD210',AND,       
                             81,80,SS,EQ,C'MOBI',AND,           
                            161,80,SS,EQ,C'FLI10=PRR.'),       
     IFTHEN=(WHEN=(1,80,SS,EQ,C'N8USD210'),                     
     BUILD=(1,80,/,81,80,/,161,80))                             
/*                 


*Partially tested, hope there are no bugs.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Jul 15, 2011 10:06 pm    Post subject: Reply to: searching multiple strings in consecutive lines
Reply with quote

amb,

vasanthz has the right idea but it doesn't need to be that complicated. Here is a simple version of the job

Code:

//STEP0100 EXEC PGM=ICETOOL                                       
//TOOLMSG  DD SYSOUT=*                                           
//DFSMSG   DD SYSOUT=*                                           
//IN       DD DATA,DLM=@@                                         
//END OF DATA                                                     
//****************************************************           
//STEP05   EXEC N8USD210,                                         
//         MOBZ=MOBI001,                                         
//         FLI10=PRR.A000T00.RRD0200A.GLREPT(+1)                 
L01    XXRRPTOMOB  PROC MOBIUSXX=MOBIUSXX                         
L01    XX*********************************************           
L01    XX*----- LOAD DATASET TO MOBIUS                           
L01    XX*********************************************           
L01    XXSTEP010  EXEC PGM=IEBGENER                               
//*                                                               
//**************   END OF JCL RRD0200A   *************           
L01    XXSYSPRINT DD DUMMY                                       
L01    XXSYSIN    DD DUMMY                                       
L01    XXSYSUT1   DD DISP=SHR,DSN=&FLI10                         
@@                                                               
//OUT      DD SYSOUT=*                                           
//SYSOUT   DD SYSOUT=*                                           
//TOOLIN   DD *                                                   
  SELECT FROM(IN) TO(OUT) ON(81,9,CH) EQUAL(3) USING(CTL1)       
//CTL1CNTL DD *                                                   
  OPTION COPY                                                     
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,80,SS,EQ,C'N8USD210'),       
  RECORDS=3,PUSH=(81:ID=8,SEQ=1)),                               
  IFTHEN=(WHEN=(1,80,SS,EQ,C'MOBI'),                             
  OVERLAY=(89:89,1,ZD,SUB,+1,ZD,LENGTH=1)),                       
  IFTHEN=(WHEN=(1,80,SS,EQ,C'FLI10=PRR'),                         
  OVERLAY=(89:89,1,ZD,SUB,+2,ZD,LENGTH=1))                       
                                                                 
  OUTFIL OMIT=(81,9,CH,EQ,C' '),BUILD=(1,80)                     
//*
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Changeman get multiple "Browse C... elixir1986 Compuware & Other Tools 4 Fri Jul 14, 2017 1:48 am
No new posts How to write Specific Fields from Mul... Padhu SYNCSORT 6 Thu Jul 06, 2017 10:26 am
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
No new posts Unable to create multiple files using... mbattu COBOL Programming 3 Fri May 05, 2017 5:35 pm
No new posts Occurrence of various strings within ... TS70363 JCL & VSAM 1 Thu Apr 27, 2017 8:18 pm


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