|
|
| Author |
Message |
priyesh.agrawal
Global Moderator
Joined: 28 Mar 2005 Posts: 1510 Location: Chicago, IL
|
|
|
|
Hi All,
Is there any Job, which can change some specified string to another specified one in several datasets (more than 100 at a time) simultaneously.
Regards,
Priyesh. |
|
| Back to top |
|
 |
References
|
Posted: Tue May 10, 2005 6:41 pm Post subject: Re: Changing String in Multiple data sets. |
 |
|
|
 |
MGIndaco
Moderator
Joined: 10 Mar 2005 Posts: 479 Location: Milan, Italy
|
|
|
|
| I think that you need a rexx program but... which is the max amount of record for a single file? |
|
| Back to top |
|
 |
priyesh.agrawal
Global Moderator
Joined: 28 Mar 2005 Posts: 1510 Location: Chicago, IL
|
|
|
|
| Quote: |
| which is the max amount of record for a single file? |
String is of length of around 10 chars, which is needs to be replaced with another string of not more than 10 chars.
Regards,
Priyesh |
|
| Back to top |
|
 |
MGIndaco
Moderator
Joined: 10 Mar 2005 Posts: 479 Location: Milan, Italy
|
|
|
|
I'm not asking you the length of string. I'm particular interested to the quantity(in number of record) of your files. It's very important to chose the appropriate language. |
|
| Back to top |
|
 |
priyesh.agrawal
Global Moderator
Joined: 28 Mar 2005 Posts: 1510 Location: Chicago, IL
|
|
|
|
oops....
Not more than 10 records in a file.
Regards, |
|
| Back to top |
|
 |
MGIndaco
Moderator
Joined: 10 Mar 2005 Posts: 479 Location: Milan, Italy
|
|
|
|
Ok, try then with a simple rexx program.
Below I'll illustrate you jcl and source program to run it:
JCL:
//STEP010X EXEC PGM=IKJEFT01,PARM='CHANGERX'
//SYSEXEC DD DISP=SHR,DSN=LIBRARY_OF_REXX_PROGRAM
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD DUMMY
//FILELIST DD *
dataset1(or member of partitioned)
dataset2
dataset3
....
REXX:
/*% NOCOMMENT REXX */
/* PROGRAMMA: xxxxxxxx */
/* AUTORE : MGIndaco */
/* ENV. : BATCH */
ADDRESS TSO
'Profile noprefix'
Say '-----------------------------------------'
Say '- Begin ---------------------------------'
Say '-----------------------------------------'
"execio * diskr FILELIST (stem FileList. finis"
Do iList = 1 To FileList.0
i = 0
TabTmp. = ''
TabTmp.0 = 0
FileList.iList = Strip(FileList.iList,T)
say ' File in progress: ' FileList.iList
"alloc da('"FileList.iList"') f(FileIn) Shr"
"execio * diskr FileIn(stem TabTmp. finis"
"free f(FileIn)"
"alloc da('"FileList.iList"') f(FileOut) Old"
/* Define string to be changed */
Changed = 0
Par1 = 'StrOld1-------------'
Par2 = 'StrNew_____________'
Call Change
Par1 = 'StrNew_____________'
Par2 = 'StrOld2-------------'
Call Change
/* you can repeat previous 3 record */
Say ' Record R&W : ' TabTmp.0
Say ' Record changed: ' Changed
Say '-----------------------------------------'
"execio * diskw FileOut(stem TabTmp. finis"
"free f(FileOut)"
End
Say '- End -----------------------------------'
Say '-----------------------------------------'
Exit Rc
Change:
Do i = 1 To TabTmp.0
If index(TabTmp.i,Par1) > 0 Then Do
Changed = Changed + 1
StrApp = DelStr(TabTmp.i,index(TabTmp.i,Par1),Length(Par1))
TabTmp.i = Insert(Par2,StrApp,index(TabTmp.i,Par1)-1)
End
End
Return |
|
| Back to top |
|
 |
priyesh.agrawal
Global Moderator
Joined: 28 Mar 2005 Posts: 1510 Location: Chicago, IL
|
|
|
|
Hi MGIndaco,
I m getting a MAXCC=0 for the Job, but still string is not being changed in the Datsets.
Regards,
Priyesh |
|
| Back to top |
|
 |
MGIndaco
Moderator
Joined: 10 Mar 2005 Posts: 479 Location: Milan, Italy
|
|
|
|
In my sample, I change:
Par1 = 'StrOld1-------------'
in
Par2 = 'StrNew_____________'
and again:
Par1 = 'StrNew_____________'
in
Par2 = 'StrOld2-------------'
This is a double change...
Have you inserted correct string to be convert?
Have you look for some sospect display?
I tried this simple rex and it work fine! |
|
| Back to top |
|
 |
priyesh.agrawal
Global Moderator
Joined: 28 Mar 2005 Posts: 1510 Location: Chicago, IL
|
|
|
|
Hi MGIndaco,
Some doubts :
Job:
| Code: |
//STEP010X EXEC PGM=IKJEFT01,PARM='REXX'
//SYSEXEC DD DISP=SHR,DSN=USERID.PDS.NAME
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD DUMMY
//FILELIST DD *
USERID.DATA.SET1
USERID.DATA.SET2
USERID.DATA.SET3
//* |
REXX Script is written into the member "REXX" of a PDS "USERID.PDS.NAME" ...Three Data Sets are there having that string to be changed....
SCRIPT:
Only thing I changed is the String name in PAR1 & PAR2.
& Commented out the following lines.
| Code: |
Par1 = 'StrNew_____________'
Par2 = 'StrOld2-------------'
Call Change
/* you can repeat previous 3 record */
Say ' Record R&W : ' TabTmp.0
Say ' Record changed: ' Changed
Say '-----------------------------------------'
"execio * diskw FileOut(stem TabTmp. finis"
"free f(FileOut)" |
Any thing else I need to change...as I m very new to REXX......
Regards,
Priyesh. |
|
| Back to top |
|
 |
MGIndaco
Moderator
Joined: 10 Mar 2005 Posts: 479 Location: Milan, Italy
|
|
|
|
Ok, if you have changed string in Par1(From) and Par2(To) you can submit jcl and read the display in SYSTSPRT...
Use once these statement for each substitution:
Par1 = 'StrNew_____________'
Par2 = 'StrOld2-------------'
Call Change |
|
| Back to top |
|
 |
priyesh.agrawal
Global Moderator
Joined: 28 Mar 2005 Posts: 1510 Location: Chicago, IL
|
|
|
|
Hi This error I got in SYSTSPRT.....
| Code: |
-----------------------------------------
- BEGIN ---------------------------------
-----------------------------------------
FILE IN PROGRESS: USERID.DATA.SET1
INVALID DATA SET NAME, 'USERID.DATA.SET1
INVALID DATA SET NAME, 00060002'
MISSING DATA SET NAME OR *+
MISSING NAME OF DATA SET TO BE ALLOCATED
The input or output file FILEIN is not allocated. It cannot be opened for I/O.
EXECIO error while trying to GET or PUT a record.
FILE FILEIN NOT FREED, IS NOT ALLOCATED
INVALID DATA SET NAME, 'USERID.DATA.SET1
INVALID DATA SET NAME, 00060002'
MISSING DATA SET NAME OR *+
MISSING NAME OF DATA SET TO BE ALLOCATED
After this same message for other two data sets also.
- END -----------------------------------
-----------------------------------------
READY
END |
Regards,
Priyesh. |
|
| Back to top |
|
 |
MGIndaco
Moderator
Joined: 10 Mar 2005 Posts: 479 Location: Milan, Italy
|
|
|
|
2 solutions:
Have you maintained the instruction "profile noprefix"?
Can you try with dsnames in quotes? |
|
| Back to top |
|
 |
priyesh.agrawal
Global Moderator
Joined: 28 Mar 2005 Posts: 1510 Location: Chicago, IL
|
|
|
|
Hi MGIndaco,
Firstly Thanks a lot for the effort u r putting towards the query.
| Quote: |
| Have you maintained the instruction "profile noprefix"? |
Yeah, I had that line in my code as it was in your code...
| Quote: |
| Can you try with dsnames in quotes? |
I tried with this too, but the same error I m getting.
Actually This is the first time I m going thru any REXX program. Thats why I m not able to put a more clear picture about it.
Regards,
Priyesh |
|
| Back to top |
|
 |
MGIndaco
Moderator
Joined: 10 Mar 2005 Posts: 479 Location: Milan, Italy
|
|
|
|
I like very much rexx and its means.
I want to apologize, to moderator and members, for this discussion in Jcl forum and not in its own.
I'm looking your display and the only problem that I can find is a missing quote in dsname at this row:
INVALID DATA SET NAME, 'USERID.DATA.SET1
that is a consequence of this command:
"alloc da('"FileList.iList"') f(FileIn) Shr"
I think, but I'm also sure, that you have copy-paste the source specify in my sample but I ask you if quotes ' and " are correct and if both this are ok, I finally ask you to remove the single quote converting the previous string to:
"alloc da("FileList.iList") f(FileIn) Shr" /* all the quotes are double */
Both here and 3 rows after when you alloc the same dataset in Old for output:
"alloc da("FileList.iList") f(FileOut) Old" /* all the quotes are double */
with pleasure... |
|
| Back to top |
|
 |
priyesh.agrawal
Global Moderator
Joined: 28 Mar 2005 Posts: 1510 Location: Chicago, IL
|
|
|
|
I tried with all the combinations, single quotes, double quotes & Both. But the same problem.
Well, MGIndaco.... really appreciate your effort. I think its better not to bother you more for this. I'll try to get it done.
Once again Thanks Forum for giving us arena for the bout & partners like MGIndaco.
Regards,
Priyesh. |
|
| Back to top |
|
 |
|
|