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

Replacing values within fields


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

New User


Joined: 17 Apr 2008
Posts: 26
Location: Oviedo, FL

PostPosted: Fri May 15, 2009 6:19 pm
Reply with quote

Is it possible to replace values within a field without looking at each character in the field. The commas or quotes can appear in any positon.

In my example i want to replace all commas and quotation marks with a question mark

Input file contains invoice-number (15 ch), description (23 Ch), and vendor-name (24 ch)

Input
invoice,"123456description,,"",1234567vendor"",name12345678901

Output
invoice??123456description?????1234567vendor???name12345678901
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri May 15, 2009 6:29 pm
Reply with quote

FINDREP would probably suffice.
Doc for July, 2008 DFSORT PTF (FINDREP, WHEN=GROUP, DATASORT, SUBSET, etc)

www.ibm.com/servers/storage/support/software/sort/mvs/ugpf/

there is a 'STICKY' in the DFSORT/ICETOOL forum that has links to all of DFSORT documentation.
Back to top
View user's profile Send private message
jr3011

New User


Joined: 17 Apr 2008
Posts: 26
Location: Oviedo, FL

PostPosted: Fri May 15, 2009 7:10 pm
Reply with quote

Thanks Dinosauer,
The PTF (90013) is in the loop to be installed within the next couple of weeks. So, i guess i have to wait for that.

Thanks alot for your help.
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 May 15, 2009 9:47 pm
Reply with quote

Here are two ways to do what you want.

With FINDREP (PTF UK90013 required):

Code:

  OPTION COPY                                   
  INREC FINDREP=(IN=(C',',C'"'),OUT=C'?')       


Without FINDREP (PTF UK90013 not required):

Code:

  OPTION COPY                         
  ALTSEQ CODE=(6B6F,7F6F)             
  INREC OVERLAY=(1:1,62,TRAN=ALTSEQ)   
Back to top
View user's profile Send private message
jr3011

New User


Joined: 17 Apr 2008
Posts: 26
Location: Oviedo, FL

PostPosted: Sat May 16, 2009 12:38 am
Reply with quote

Frank,
Thanks for the response. You guys are great. I tried using the ALTSEQ method and it worked with one exception. My record contains some packed decimal fields, so it converted the '7F's to '6F's. Is it possible to define the fields (positions) i want to convert, or do i need to wait for the PTF and use the FINDREP method ?

Thanks for your help.
John Hagan
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: Sat May 16, 2009 12:56 am
Reply with quote

Yes, you can specify the positions you want to convert with both FINDREP and TRAN=ALTSEQ. For example, if you wanted to convert only 11-20 and 31-40, you could use:

Code:

  OPTION COPY                                                   
  INREC IFTHEN=(WHEN=INIT,                                     
    FINDREP=(STARTPOS=11,ENDPOS=20,IN=(C',',C'"'),OUT=C'?')),   
   IFTHEN=(WHEN=INIT,                                           
    FINDREP=(STARTPOS=31,ENDPOS=40,IN=(C',',C'"'),OUT=C'?'))   


or

Code:

  OPTION COPY                         
  ALTSEQ CODE=(6B6F,7F6F)             
  INREC OVERLAY=(11:11,10,TRAN=ALTSEQ,31:31,10,TRAN=ALTSEQ)   
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 Replacing 'YYMMDD' with date, varying... SYNCSORT 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
No new posts Null values are considered in Total c... DFSORT/ICETOOL 6
No new posts Converting ASCII values to COMP-3 (ZD... JCL & VSAM 2
Search our Forums:

Back to Top