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
 

 

How I can search for a string in a record

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

New User


Joined: 17 Apr 2009
Posts: 70
Location: India

PostPosted: Fri Jun 05, 2009 8:18 pm    Post subject: How I can search for a string in a record
Reply with quote

Can you please let me know how I can search for a string in a record?

My requirement is

I have a file with record length 4600 and its a VB file.
I need to search for a string based on the parm I pass.

ex recs
AAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBAAAAAAAAAAAA
CCCCCCCCCCCCBBBBCCCCCCCCCCCCCCCCCCCCCCCC
SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
DDDDDDDDDDDDDDDDDDDBBBBDDDDDDDDDDDDDDDDD
SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
EEEEEBBBBEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE

in these records i have BBBB some where in free form text....i need to write those records to output.

My output should be
AAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBAAAAAAAAAAAA
CCCCCCCCCCCCBBBBCCCCCCCCCCCCCCCCCCCCCCCC
DDDDDDDDDDDDDDDDDDDBBBBDDDDDDDDDDDDDDDDD
EEEEEBBBBEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
Back to top
View user's profile Send private message

Hima1985

New User


Joined: 17 Apr 2009
Posts: 70
Location: India

PostPosted: Fri Jun 05, 2009 8:20 pm    Post subject: forgot to mention
Reply with quote

I need to pass this BBBB as parm.......and it will be always 4byte string only.......it might be BBBB or CCCC or DDDD.....etc
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Fri Jun 05, 2009 9:15 pm    Post subject: Reply to: Search a string
Reply with quote

Hima1985,

The following JCL will give you the desired results. We Plug in a small rexx exec which would read in the symbolic parms you pass and create symbol with the value you passed.

Create a member called HIMSYM in any of your existing pds which contains the following
Code:

/* REXX */                                     
"ALLOC FI(OUTDD) DA('HIMA.sym') SHR REUSE"   
PULL ARG                                       
QUEUE 'SYM1,C'''||ARG(1)||''''                 
"EXECIO 1 DISKW OUTDD (FINIS"                 
"FREE FI(OUTDD)"                               

The above rexx exec will create a 80 byte file
Code:

SYM1,C'BBBB'   


Which we will use in the next step to pass the value to your control cards. You can even make the BBBB as a symbolic and pass it dynamically.

Code:

//STEP0100 EXEC PGM=IKJEFT01,PARM='%HIMSYM BBBB'
//SYSTSPRT DD SYSOUT=*                             
//SYSPRINT DD SYSOUT=*                             
//SYSTSIN  DD DUMMY                                 
//SYSEXEC  DD DSN=HIMA.ANY.PDS.EXEC,DISP=SHR         
//OUTDD    DD DSN=HIMA.SYM,DISP=(,PASS),         
//            SPACE=(TRK,(1,0),RLSE),               
//            DCB=(RECFM=FB,LRECL=80,BLKSIZE=27920)
//* 
//STEP0200 EXEC PGM=SORT                             
//SYSOUT   DD SYSOUT=*                               
//SYMNAMES DD DSN=HIMA.SYM,DISP=(OLD,DELETE,DELETE)
//SORTIN   DD DSN=your input vb 4600 byte file,DISP=SHR
//SORTOUT  DD SYSOUT=*                               
//SYSIN    DD *                                       
  INCLUDE COND=(5,4596,SS,EQ,SYM1)                   
  OPTION COPY,VLSCMP
//*
Back to top
View user's profile Send private message
Hima1985

New User


Joined: 17 Apr 2009
Posts: 70
Location: India

PostPosted: Fri Jun 05, 2009 9:37 pm    Post subject:
Reply with quote

Kolusu,

Thanks for the reply, There is no other way other than usin REX?
Back to top
View user's profile Send private message
Hima1985

New User


Joined: 17 Apr 2009
Posts: 70
Location: India

PostPosted: Fri Jun 05, 2009 9:43 pm    Post subject:
Reply with quote

Just because i never used rex in my job till now
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Fri Jun 05, 2009 10:36 pm    Post subject: Reply to: Search a string
Reply with quote

Hima1985,

Even though you haven't used rexx till now, you had everything coded up for you. cant you just copy and run it and see if it works?

You can always write a program to read the parms and generate the symbols for you . You can pass Symbolic parms to COBOL program which would create the necessary symbol names for the Sort Step.
Back to top
View user's profile Send private message
Hima1985

New User


Joined: 17 Apr 2009
Posts: 70
Location: India

PostPosted: Fri Jun 05, 2009 11:58 pm    Post subject:
Reply with quote

Kolusu,

I am 100% sure that the solution provided by you works pretty well, No doubts at all.

Just wanted to know if any otherway around to achieve the same.
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 Fileaid Update Replace with null string descann Compuware & Other Tools 4 Mon May 15, 2017 3:00 pm
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
No new posts Sort Large record length cmsmoon DFSORT/ICETOOL 14 Tue Apr 11, 2017 5:49 pm
No new posts Format record to remove Leading zeroes Learncoholic DFSORT/ICETOOL 14 Wed Apr 05, 2017 2:43 pm


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