Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Repalcing a particular field of a file using SORT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
dineshsjce
Currently Banned

New User


Joined: 16 Apr 2007
Posts: 41
Location: Bangalore

PostPosted: Thu Sep 25, 2008 9:09 pm    Post subject: Repalcing a particular field of a file using SORT
Reply with quote

Hi Friends,
I have a file which contains:
CD DEKIDAKA
CD DOWNLOAD
PUT 'THE.DEKI.APL' TEST1.TXT
QUIT


My requirement is that, in place of TEST1.TXT I need to copy some string (This string varies, it is not constant) from another file. Only TEST1.TXT I need to change, remaining things I want as it is.

How can I accomplish this using SORT?
Back to top
View user's profile Send private message

gorman
Currently Banned

New User


Joined: 23 Sep 2008
Posts: 10
Location: Chennai

PostPosted: Thu Sep 25, 2008 9:33 pm    Post subject: Use File-Aid for replace.
Reply with quote

Hi,

You can use batch File-Aid to meet your requirement....... It is tested and working...... icon_biggrin.gif

Code:

//STEP2   EXEC PGM=FILEAID                             
//SYSPRINT DD  SYSOUT=*                                 
//DD01     DD *                                         
PUT 'THE.DEKI.APL' TEST1.TXT                           
//DD01O    DD SYSOUT=*                                 
//SYSIN    DD  *                                       
$$DD01 COPY REPL=(20,C'WHATEVERTEXTYOUWANTTOCHANGE.TXT')
//*                                                     


Hope it helps...... icon_wink.gif

Thanks.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Thu Sep 25, 2008 9:37 pm    Post subject:
Reply with quote

An external variable can be accessed as in JCL with a file as input in sort.....
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Thu Sep 25, 2008 10:14 pm    Post subject:
Reply with quote

Dinesh,

Here's a DFSORT job that will do what you asked for. Replace NEWNAME.TXT with whatever new file name you need. The SYMNAMES record can be in a file with RECFM=FB and LRECL=80 if that's what you need.

Code:

//S1    EXEC  PGM=ICEMAN                           
//SYSOUT    DD  SYSOUT=*                           
//SYMNAMES DD *                                   
New_file,'NEWNAME.TXT'   
/*                         
//SORTIN DD DSN=...   input file                                     
//SORTOUT DD DSN=...  output file                             
//SYSIN    DD    *                                 
  OPTION COPY                                     
  INREC FINDREP=(IN=C'TEST1.TXT',OUT=New_file)     
/*


You can put the SYMNAMES record in a separate file with RECFM=FB and LRECL=80 if appropriate. In that case, just use this SYMNAMES DD:

//SYMNAMES DD DISP=SHR,DSN=...

The job uses DFSORT's new FINDREP function available with z/OS DFSORT V1R5 PTF UK90013 (July, 2008). If you don't have this PTF, ask your System Programmer to install it (it's free).

For complete details on the new FINDREP function and the other new functions available with PTF UK90013, see:

www.ibm.com/systems/support/storage/software/sort/mvs/ugpf/
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts INVALID FIELD OR CONSTANT IN SORTOF ?? Ron Klop DFSORT/ICETOOL 8 Wed Jan 11, 2017 3:44 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts Performing arithmetic on input field zh_lad DFSORT/ICETOOL 31 Tue Dec 06, 2016 8:04 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us