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 Check Binary Values for symbols gandikk CA Products 3 Tue Mar 21, 2017 5:11 am
No new posts To display values of multiple rows in... vinu78 DB2 2 Thu Mar 09, 2017 1:20 pm
No new posts DFSORT MUL FIELDS tspr52 DFSORT/ICETOOL 16 Fri Mar 03, 2017 11:53 pm
No new posts Replacing same string with different ... vickey_dw DFSORT/ICETOOL 6 Wed Feb 22, 2017 10:44 pm
No new posts setting new limit Key values for inde... srilata83 DB2 1 Fri Feb 10, 2017 9:24 pm


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