View previous topic :: View next topic
|
Author |
Message |
chiru_sh
New User
Joined: 21 Feb 2008 Posts: 18 Location: Mumbai
|
|
|
|
Hi,
I am facing a problem in which i need to search a string in a file.
For eg. My file looks like this
FILE1 (FB 80)
Code: |
CUSTOMER1 10100
MNTHLY STMT BALANCE 2000
CUSTOMER2 11100
MNTHLY STMT REQUIRES MODIFICATION ACCT BALANCE 5000
CUSTOMER3 11111
YOUR INFO ENCLOSED
MNTHLY STMT REQUIRES MODIFICATION ACCT BALANCE 7000
|
My file looks like above one. In which the records do not have any key and the information is embedded in the file randomly.
I want to check & replace all the values of balance.
i.e. I want to search the file for keyword 'BALANCE' and whatever value is there i need to change it.
I want to make it look like this through batch job.
FILE1 (FB 80)
Code: |
CUSTOMER1 10100
MNTHLY STMT BALANCE [b]1000[/b]
CUSTOMER2 11100
MNTHLY STMT REQUIRES MODIFICATION ACCT BALANCE 1000
CUSTOMER3 11111
YOUR INFO ENCLOSED
MNTHLY STMT REQUIRES MODIFICATION ACCT BALANCE 1000
|
|
|
Back to top |
|
|
karthikr44
Active User
Joined: 25 Aug 2007 Posts: 235 Location: Chennai
|
|
|
|
Through REXX it is possible... |
|
Back to top |
|
|
ssk1711
New User
Joined: 16 Jun 2008 Posts: 40 Location: bangalore
|
|
|
|
Hi,
Assuming u know REXX.
you can invoke ISPF command " C 'str1' 'str2' all " using REXX that will do the required jbo for u. |
|
Back to top |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
ssk,
Quote: |
you can invoke ISPF command " C 'str1' 'str2' all " using REXX that will do the required jbo for u. |
I doubt if this would work as "str1" is not the same throughout the file.
If you are ok with rexx, All you will have to do is read the file into a stem variable, use "substr" to find the text "balance" and update the record with the value 1000 one space after balance. |
|
Back to top |
|
|
ssk1711
New User
Joined: 16 Jun 2008 Posts: 40 Location: bangalore
|
|
|
|
ho.. sorry.. using " c 'str1' 'str2' all" the requirement could not be met.
and we can use SUBSTR. Also one way is to use OVERLAY function.
logic could be like,
str ---> stem variable containig the lines of the dataset
loop:
pos = index(str,'BALANCE')
pos = pos + 8
overlay('1000',str,pos)
write to the dataset
loop-ends |
|
Back to top |
|
|
chiru_sh
New User
Joined: 21 Feb 2008 Posts: 18 Location: Mumbai
|
|
|
|
But the problem is I have to create a batch job for it. I have to schedule it in prod. I cannot use REXX. Is there any way,from which we can use SORT??? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
I cannot use REXX. |
Why not? REXX works in batch. . . |
|
Back to top |
|
|
Vasukip Currently Banned New User
Joined: 17 Jun 2008 Posts: 48 Location: Chennai
|
|
|
|
chiru_sh wrote: |
But the problem is I have to create a batch job for it. I have to schedule it in prod. I cannot use REXX. Is there any way,from which we can use SORT??? |
you can use ds !
Rexx is executed in batch using JCL
//TSOXXXX1 JOB (TEST),MSGCLASS=X
//JS01 EXEC PGM=IKJEFT01
//SYSPRINT DD SYSOUT=*
//SYSTSPRT DD SYSOUT=*
//SYSEXEC DD DSN=T.TSOXXXX.REXX,DISP=SHR
//SYSTSIN DD *
Rexx1 parm1 parm2
/* |
|
Back to top |
|
|
chiru_sh
New User
Joined: 21 Feb 2008 Posts: 18 Location: Mumbai
|
|
|
|
Thanks for the JCL. I have to check the REXX to do it.
If possible can we do it by sort. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Quote: |
If possible can we do it by sort. |
It is now possible with DFSORT if you have z/OS DFSORT V1R5 PTF UK90013 (July, 2008) installed. Here's the DFSORT job:
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
CUSTOMER1 10100
MNTHLY STMT BALANCE 2000
CUSTOMER2 11100
MNTHLY STMT REQUIRES MODIFICATION ACCT BALANCE 5000
CUSTOMER3 11111
YOUR INFO ENCLOSED
MNTHLY STMT REQUIRES MODIFICATION ACCT BALANCE 7000
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC FINDREP=(IN=C'BALANCE',OUT=C'BALANCE 1000',SHIFT=NO)
/*
|
For complete details on the new FINDREP function and the other new functions available with PTF UK90013, see:
Use [URL] BBCode for External Links |
|
Back to top |
|
|
|