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
 

 

Replacing values within fields

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Replacing values within fields
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    Post subject:
Reply with quote

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

http://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    Post subject: Reply to: Replacing values within fields
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 Moderator


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

PostPosted: Fri May 15, 2009 9:47 pm    Post subject:
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    Post subject: Reply to: Replacing values within fields
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 Moderator


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

PostPosted: Sat May 16, 2009 12:56 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SYNCSORT SEQNUM and FI fields. nartcr SYNCSORT 5 Sat Jan 21, 2017 4:02 am
No new posts Syncsort Help to group fields sudhakarraju SYNCSORT 6 Thu Dec 29, 2016 1:38 am
No new posts SQL query to run through list of valu... Ni3-db2 DB2 14 Wed Dec 14, 2016 9:52 am
No new posts Overlaying one set of charater values... Kevin Lindsley SYNCSORT 7 Sat Nov 05, 2016 3:21 am
No new posts Access SQLCA fields inside a stored p... gangapd DB2 4 Thu Oct 27, 2016 10:20 am


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