IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

[Solved]Changing String in Multiple data sets.


IBM Mainframe Forums -> JCL & VSAM
Post new topic   This topic is locked: you cannot edit posts or make replies.
View previous topic :: View next topic  
Author Message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Tue May 10, 2005 6:41 pm
Reply with quote

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
View user's profile Send private message
MGIndaco

Active User


Joined: 10 Mar 2005
Posts: 432
Location: Milan, Italy

PostPosted: Tue May 10, 2005 7:00 pm
Reply with quote

I think that you need a rexx program but... which is the max amount of record for a single file?
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Tue May 10, 2005 7:03 pm
Reply with quote

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
View user's profile Send private message
MGIndaco

Active User


Joined: 10 Mar 2005
Posts: 432
Location: Milan, Italy

PostPosted: Tue May 10, 2005 7:15 pm
Reply with quote

icon_smile.gif 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
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Tue May 10, 2005 7:19 pm
Reply with quote

oops.... icon_confused.gif

Not more than 10 records in a file.

Regards,
Back to top
View user's profile Send private message
MGIndaco

Active User


Joined: 10 Mar 2005
Posts: 432
Location: Milan, Italy

PostPosted: Tue May 10, 2005 10:04 pm
Reply with quote

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
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Wed May 11, 2005 4:18 pm
Reply with quote

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
View user's profile Send private message
MGIndaco

Active User


Joined: 10 Mar 2005
Posts: 432
Location: Milan, Italy

PostPosted: Wed May 11, 2005 5:22 pm
Reply with quote

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
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Wed May 11, 2005 6:50 pm
Reply with quote

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
View user's profile Send private message
MGIndaco

Active User


Joined: 10 Mar 2005
Posts: 432
Location: Milan, Italy

PostPosted: Wed May 11, 2005 7:45 pm
Reply with quote

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
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Wed May 11, 2005 7:53 pm
Reply with quote

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
View user's profile Send private message
MGIndaco

Active User


Joined: 10 Mar 2005
Posts: 432
Location: Milan, Italy

PostPosted: Wed May 11, 2005 8:43 pm
Reply with quote

2 solutions:
Have you maintained the instruction "profile noprefix"?
Can you try with dsnames in quotes?
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Thu May 12, 2005 6:05 pm
Reply with quote

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
View user's profile Send private message
MGIndaco

Active User


Joined: 10 Mar 2005
Posts: 432
Location: Milan, Italy

PostPosted: Thu May 12, 2005 7:02 pm
Reply with quote

I like very much rexx and its means. icon_smile.gif
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
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Thu May 12, 2005 8:01 pm
Reply with quote

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
View user's profile Send private message
MGIndaco

Active User


Joined: 10 Mar 2005
Posts: 432
Location: Milan, Italy

PostPosted: Thu May 12, 2005 8:19 pm
Reply with quote

Sorry for my blindly way but I don't like lose with obvious little problem

Only a little question...
This number:00060002 is at the end the record where you specify the dataset names?
Have you numberd jcl?
look within your jcl at bottom right to see if you have numbers.... and if is true unnum your jcl with command( from command line): "Renum" and after "unnum" number must be cleaned...(do not use these command from sdsf but only from your library)

If it doesn't work i will apologize for my persistence and for the time I've steal to you.
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Thu May 12, 2005 9:10 pm
Reply with quote

For what it's worth, your code worked just fine on my (z/OS 1.4) system.
Back to top
View user's profile Send private message
MGIndaco

Active User


Joined: 10 Mar 2005
Posts: 432
Location: Milan, Italy

PostPosted: Thu May 12, 2005 9:42 pm
Reply with quote

I'm happy to hear it!
Thank's a lot for your test, Superk.
But... I will be much more happy if this little source let us the favour of run also for Priyesh.
See you tomorrow.
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Fri May 13, 2005 6:02 pm
Reply with quote

Hi MGIndaco,

After a very nice foray in REXX from the last two days & some PMs with you....I m glad to tell you, that your code worked well for my test files & test string.

I really appreciate your continuous efforts & PERSISTENCE for solving the problem.

As I m a 2 day old fresher for REXX. Can you give me some useful links & material for the REXX Programing.

Once again thanks a lot to every body involved specially MGIndaco.

Regards,

Priyesh
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Fri May 13, 2005 10:46 pm
Reply with quote

Got enough links while browsing thru FORUM. icon_biggrin.gif

Thanks FORUM.

Priyesh.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   This topic is locked: you cannot edit posts or make replies. View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 2
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
Search our Forums:

Back to Top