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

Replace A to space in 10th position thru SORT


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
maxsubrat

Active User


Joined: 27 Feb 2008
Posts: 110
Location: india

PostPosted: Fri Apr 23, 2010 11:22 am
Reply with quote

I have a input file which has a character A in 10th position.
I want to replace it to space in that 10th position.

But i have other character in the file in position 10th. i don't want to change that.
Also i have character A in other column and i don't want to disturb that.

Please someone try for a SORT.
Thanks
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Fri Apr 23, 2010 11:42 am
Reply with quote

Hi,

here is a couple of ways of doing this

Code:

//ALTSEQ   EXEC PGM=SORT                                             
//SORTIN   DD *                                                       
123456789A123456789                                                   
123456789B123456789                                                   
//SORTOUT  DD SYSOUT=*                                               
//SYSOUT   DD SYSOUT=*                                               
//SYSIN    DD *                                                       
     SORT FIELDS=COPY                                                 
     ALTSEQ CODE=(C140)                                               
     INREC OVERLAY=(10:10,1,TRAN=ALTSEQ)                             
/*                                                                   
//OVERLAY  EXEC PGM=SORT                                             
//SORTIN   DD *                                                       
123456789A123456789                                                   
123456789B123456789                                                   
//SORTOUT  DD SYSOUT=*                                               
//SYSOUT   DD SYSOUT=*                                               
//SYSIN    DD *                                                       
   SORT FIELDS=COPY                                                   
   INREC IFTHEN=(WHEN=(10,1,CH,EQ,C'A'),OVERLAY=(10:C' '))           
/*                                                                   


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

Active User


Joined: 27 Feb 2008
Posts: 110
Location: india

PostPosted: Fri Apr 23, 2010 2:14 pm
Reply with quote

This is working..

I have another requirement :

I have few records and i want to replace one character to space based on some condition:

1. those records have L in the 1st character of the record and
2. those records have A in the 10th character.

Then i want to replace the 10th character from A to space.

Please someone help me out..

Thanks
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 Apr 23, 2010 9:59 pm
Reply with quote

Here's a DFSORT job that will do what you asked for:

Code:

//S1 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*                                                     
//SORTIN   DD DSN=...  input file                                                   
//SORTOUT  DD DSN=...  output file                                           
//SYSIN    DD *                                                   
   SORT FIELDS=COPY                                               
   INREC IFTHEN=(WHEN=(1,1,CH,EQ,C'L',AND,10,1,CH,EQ,C'A'),       
     OVERLAY=(10:X))                                               
/*                                                                 


If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000080
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 -> DFSORT/ICETOOL

 


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 Replace each space in cobol string wi... COBOL Programming 3
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
Search our Forums:

Back to Top