View previous topic :: View next topic
|
Author |
Message |
Hima1985
New User
Joined: 17 Apr 2009 Posts: 70 Location: India
|
|
|
|
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 |
|
|
Hima1985
New User
Joined: 17 Apr 2009 Posts: 70 Location: India
|
|
|
|
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 |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
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
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 |
|
|
Hima1985
New User
Joined: 17 Apr 2009 Posts: 70 Location: India
|
|
|
|
Kolusu,
Thanks for the reply, There is no other way other than usin REX? |
|
Back to top |
|
|
Hima1985
New User
Joined: 17 Apr 2009 Posts: 70 Location: India
|
|
|
|
Just because i never used rex in my job till now |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
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 |
|
|
Hima1985
New User
Joined: 17 Apr 2009 Posts: 70 Location: India
|
|
|
|
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 |
|
|
|