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

Changing contents of members in a pds using Sort


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
kovur

New User


Joined: 15 Nov 2007
Posts: 36
Location: India

PostPosted: Fri Jul 15, 2011 4:11 pm
Reply with quote

Hi,

Is it possible to change contents of members of a pds using sort. I have the below requirement. I have a parm library in which I have some ftp parms. I would like to change the contents of the parms without going to each and every parm.

I have parms in the library with the below format:
Code:

SERVER.OLD
USERNAME1             
PASSWORD1             
cd  /PATH1/OLD


I would like to use SORT utility to check the members of the library and if it finds the parm containing this data, it should change the data as below:
Code:

SERVER.NEW
USERNAME2             
PASSWORD2             
cd  /PATH2/NEW


Also I have some parms with tha below data:
Code:

REXEC -l username1 -p
password1 server.old +                   
/path1/old/script/ascrip.sh
/path1/old/abc/afile


I would like to change the data as below:

Code:

REXEC -l username2 -p password2
server.new +                   
/path2/new/script/ascrip.sh
/path2/new/def/afile


Please let me know if this can be done thru SORT. If not please suggest any method of doing it.

Thanks,
Manoj
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Jul 15, 2011 4:20 pm
Reply with quote

Be careful doing batch updates to a PDS. If you have more than one job updating the PDS at the same time, you have the potential to screw up the PDS. "More than one job" can include a TSO session. I'd suggest DISP=OLD for your PDS, and remember that if the jobs all sit there in the input queue, someone has the file in TSO.
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Fri Jul 15, 2011 4:25 pm
Reply with quote

Hello,
You could try the below job to perform find and replace in all members of a PDS.
Code:
//UPDAT1 EXEC PGM=IPOUPDTE,                       
// PARM='UPDATE'                                   
//*PARM='CHECK'                                   
//@LIB1 DD DISP=SHR,DSN=YOUR.PDS
//SYSPRINT DD SYSOUT=*                             
//SYSIN DD *                                       
FROM-STRING<TO-STRING<                                 
//                                                 

Note: For this program to work, the destination PDS has to have a empty member named $$$COIBM.

Hope it helps.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Jul 15, 2011 10:41 pm
Reply with quote

Quote:
Please let me know if this can be done thru SORT.


DFSORT is NOT really the tool of choice for updating PDS members en masse.

DFSORT can only deal with one member at a time. So you would need a separate step (or ICETOOL operator) to change each member.
Back to top
View user's profile Send private message
giraffe

New User


Joined: 09 Nov 2010
Posts: 27
Location: SHENZHEN CHINA

PostPosted: Sun Jul 17, 2011 7:33 pm
Reply with quote

There's a solution I worked out, but it's a little compicated.
Firstly, using IKJEFT01 to exec LISTDS command, then use ICETOOL SUBSET to eliminate the header and trailer information in order to obtain the member list.
Secondly, generate a job from the member list with SORT FINDREP steps.
Finally, exec IKJEFT01 SUBMIT command to submit the generated job, the mission's done.
However, if there're two many members in your pds, you will have to generate several jobs to complete this.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Mon Jul 18, 2011 12:24 am
Reply with quote

giraffe

You have done about ten times more work than is required.

You can list the members and not have to sort the output to get a workable list.

Why perform a sort step for every single member when an ISPF edit macro will do exactly the same.

Submit gazillions of jobs when one will suffice.

Methinks that you may be talking out of the wrong end on this topic
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Mon Jul 18, 2011 9:54 am
Reply with quote

Adding to Expat's view,
Also, DFSORT copy does not copy the member statistics like created,changed,version details of a pds member. which might be handy information at times.
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Mon Jul 18, 2011 10:04 am
Reply with quote

Hi Frank,

Quote:
DFSORT is NOT really the tool of choice for updating PDS members en masse.



This could be your next challenge. icon_smile.gif


Gerry
Back to top
View user's profile Send private message
kovur

New User


Joined: 15 Nov 2007
Posts: 36
Location: India

PostPosted: Mon Jul 18, 2011 5:59 pm
Reply with quote

Hi,

I tried to do this by using IPOUPDTE. But it is not identifying the strings that I gave in the sysin dd * statement. In the spool it is showing that there are no updates.

Please check the job, Member and spool output that I have got and suggest what needs to be corrected.

Job:
Code:

//STEP01  EXEC PGM=IPOUPDTE,PARM='UPDATE'   
//@LIB1   DD DSN=MY.TEST.PDS1,DISP=SHR
//SYSIN   DD *                             
server.old<server.new<                     
username1<username2<                       
password1<password2<                       
/path1/old</path2/new<                     
/*                                         
//SYSPRINT DD SYSOUT=*                     
//                                         


Member in the PDS, MY.TEST.PDS1
Code:

 VIEW       MY.TEST.PDS1(TESTPARM) - 01.04           
 Columns 00001 00072
 Command ===>                                               
   Scroll ===> CSR 

 000001 server.old                                                             
 000002 username1                                                               
 000003 password1                                                               
 000004 cd  /path1/old                                                         



Spool output:
Code:

BATCH JCL TAILORING AID                       
 UPDATE CONTROL STATEMENTS       

 SYSIN          SERVER.OLD<SERVER.NEW<                                 
 SYSIN          USERNAME1<USERNAME2<                                   
SYSIN          PASSWORD1<PASSWORD2<                                   
SYSIN          /PATH1/OLD</PATH2/NEW<                                 
 MESSAGE        IPO005
END OF INPUT CONTROL STATEMENTS                 
BATCH JCL TAILORING AID           
VOL=TSO006 DSNAME=MY.TEST.PDS1         
MESSAGE  IPO010 FILE @LIB1  HAD NO UPDATES                   
MESSAGE  IPO011 IPOUPDTE ENDED. CODE=04                         


Thanks,
Manoj
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Mon Jul 18, 2011 6:41 pm
Reply with quote

gcicchet wrote:
Hi Frank,

Quote:
DFSORT is NOT really the tool of choice for updating PDS members en masse.



This could be your next challenge. icon_smile.gif


Gerry


It looks once in thousand kind of request..


Very less often datafiles are stored in PDS..
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Jul 18, 2011 7:47 pm
Reply with quote

Hello,

Quote:
Very less often datafiles are stored in PDS..
True - not so much data as in this example, but often global jcl and/or control statement changes. . .

While there are multiple ways to do this, a "sort" way could be quite handy as well (imho) icon_smile.gif
Back to top
View user's profile Send private message
superk

Global Moderator


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

PostPosted: Mon Jul 18, 2011 8:04 pm
Reply with quote

Manoj IPOUPDTE works with JCL and CONTROL types of data. As such, it won't recognize anything defined as lower-case.
Back to top
View user's profile Send private message
giraffe

New User


Joined: 09 Nov 2010
Posts: 27
Location: SHENZHEN CHINA

PostPosted: Mon Jul 18, 2011 8:08 pm
Reply with quote

expat wrote:
giraffe

You have done about ten times more work than is required.

You can list the members and not have to sort the output to get a workable list.

Why perform a sort step for every single member when an ISPF edit macro will do exactly the same.

Submit gazillions of jobs when one will suffice.

Methinks that you may be talking out of the wrong end on this topic

ICETOOL SUBSET will do 'copy' instead of 'sort', the purpose of this step is to eliminate the header(7?) and trailer(4?) information.
There's a limitation for a job's step number, so, if there're two many members, we need to generate several aufgereiht jobs to accomplish this, since one pds(for update) can not be specified in ICETOOL DD more than once, ICETOOL with generated SORT AND CNTL statements do not work here.
This is just a solution with DFSORT, REXX is a more effecient tool here.
Back to top
View user's profile Send private message
kovur

New User


Joined: 15 Nov 2007
Posts: 36
Location: India

PostPosted: Mon Jul 18, 2011 9:31 pm
Reply with quote

Kevin,

Thanks for your reply. I just changed the contents of the member to upper case and tried. It worked fine.

The spool output :
Code:

BATCH JCL TAILORING AID                       
UPDATE CONTROL STATEMENTS       
 SYSIN          SERVER.OLD<SERVER.NEW<                                 
 SYSIN          USERNAME1<USERNAME2<                                   
 SYSIN          PASSWORD1<PASSWORD2<                                   
SYSIN          /PATH1/OLD</PATH2/NEW<                                 
 MESSAGE        IPO005
END OF INPUT CONTROL STATEMENTS                 
BATCH JCL TAILORING AID           
VOL=TSO006 DSNAME=MY.TEST.PDS1         

 TESTPARM REPLACED       SERVER.OLD                                             
          REPLACEMENT    SERVER.NEW                                             
 TESTPARM REPLACED       USERNAME1                                             
          REPLACEMENT    USERNAME2                                             
 TESTPARM REPLACED       PASSWORD1                                             
          REPLACEMENT    PASSWORD2                                             
 TESTPARM REPLACED       CD  /PATH1/OLD                                         
          REPLACEMENT    CD  /PATH2/NEW                                         
  MESSAGE  IPO011 IPOUPDTE ENDED. CODE=00                         


But all the strings that I need to change are in lower case only. Please suggest a way to achieve this.

Thanks,
Manoj
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Jul 18, 2011 10:31 pm
Reply with quote

Hello,

Quote:
But all the strings that I need to change are in lower case only. Please suggest a way to achieve this.

Quote:
Manojm IPOUPDTE works with JCL and CONTROL types of data. As such, it won't recognize anything defined as lower-case.


Use something other than IPOUPDTE . . . As has been suggested REXX would work well.
Back to top
View user's profile Send private message
superk

Global Moderator


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

PostPosted: Tue Jul 19, 2011 7:38 pm
Reply with quote

Manoj, everything I've read here so far seems to be bordering on excessive overkill. Don't you have tools you can easily use or readily adapt to handle this (FileAid, File Manager, etc.) without having to write code? Are there a lot of members to be updated, or is it a relatively small set that a few repetitive job submissions could've handled? IPOUPDTE would've been the perfect option but you have the issue with the lower-case text.

As a somewhat simple process, couldn't you just:

1. Use IEBPTPCH to "PUNCH" the selected members of the PDS into a sequential dataset.
2. Use SORT to reformat the IEBPTPCH output into a standard IEBUPDTE-ready format.
3. Edit the data to enable your changes.
4. Use IEBUPDTE to create a PDS from the edited dataset.

All of which has been described here many times before, as has IPOUPDTE, as has writing REXX execs to do this, as has writing and using ISPF Edit Macros, and writing COBOL programs to do this.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Tue Jul 19, 2011 8:08 pm
Reply with quote

superk wrote:
Don't you have tools you can easily use or readily adapt to handle this without having to write code?

Yes; giraffe, vasanthz, probably a couple of others.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Jul 19, 2011 8:19 pm
Reply with quote

kovur wrote:
Hi Giraffe,

Thanks for the code. I will try this and let you know my experience with it.

Regards,
Manoj


Remembering to do the change to lower case, in at least four places!
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Tue Jul 19, 2011 10:00 pm
Reply with quote

Quote:
Yes; giraffe, vasanthz, probably a couple of others.

Well, I suggested IPOUPDTE which is'nt much work & we don't have file-aid or file manager or insync..

writing a new rexx or dfsort is too much overkill & i never voted for it..
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
No new posts how to calculate SUM value for VB fil... DFSORT/ICETOOL 1
Search our Forums:

Back to Top