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

Repalcing a particular field of a file using SORT


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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
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: 2146
Location: At my coffee table

PostPosted: Thu Sep 25, 2008 9:37 pm
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 Developer


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

PostPosted: Thu Sep 25, 2008 10:14 pm
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:

Use [URL] BBCode for External Links
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 FTP VB File from Mainframe retaining ... JCL & VSAM 1
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top