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
 

 

find and replace characters in a string

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
V S Amarendra Reddy

Active User


Joined: 13 Sep 2006
Posts: 200
Location: USA

PostPosted: Sun Aug 04, 2013 5:03 am    Post subject: find and replace characters in a string
Reply with quote

Hi,

My input file attributes are LRECL=80,RECFM=FB. My input data is as below.
111ABC12345ED111
222FADL7435BE222
33334A65DE7CF333

Now, I need to scan thru the bytes from position 4 thru 10 bytes and change A,B,C, to number 2 and D,E,F to number 3. Also I need to build the output record as below.

OUTREC FIELDS=(1,3,14,3,Original 4,10 and Converted 4,10)

I tried to do the below, but it isn't working.

we are using sync sort product version 1.4.0. I am getting the below error.

Code:

SORT FIELDS=COPY
INREC IFTHEN=(WHEN=INIT,FINDREP=(STARTPOS=4,ENDPOS=13,IN='A',OUT='2')),
                                                     *
IFTHEN=(WHEN=INIT,FINDREP=(STARTPOS=4,ENDPOS=13,IN='B',OUT='2')),
IFTHEN=(WHEN=INIT,FINDREP=(STARTPOS=4,ENDPOS=13,IN='C',OUT='2')),
IFTHEN=(WHEN=INIT,FINDREP=(STARTPOS=4,ENDPOS=13,IN='D',OUT='3')),
IFTHEN=(WHEN=INIT,FINDREP=(STARTPOS=4,ENDPOS=13,IN='E',OUT='3')),
IFTHEN=(WHEN=INIT,FINDREP=(STARTPOS=4,ENDPOS=13,IN='F',OUT='3')),
OUTREC FIELDS=(1,3,14,3,3,4,10)
WER268A  INREC STATEMENT    : SYNTAX ERROR


Can someone please help in this regard?

Also, is there a smart way to simplify the code as I might have more conditions like 'G' thru 'I' to number 4, 'J' thru 'L' to number 5 and so on...
Regards
Amar
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Sun Aug 04, 2013 5:17 am    Post subject: Reply to: find and replace characters in a string
Reply with quote

You are not specifying the constants correctly: C'A' not 'A'.

Have a look in your documentation for INOUT, where you specify the input and output contants in pairs, In1,Out1,In2,Out2,In3,Ouit3 etc.
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Fileaid Update Replace with null string descann Compuware & Other Tools 4 Mon May 15, 2017 3:00 pm
No new posts Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm
No new posts find RACF group for access to spooled... jzhardy JCL & VSAM 1 Mon May 08, 2017 11:46 am
No new posts To find out size allocated to a seque... ashek15 JCL & VSAM 15 Thu Apr 27, 2017 9:42 am
No new posts Replacing same string with different ... vickey_dw DFSORT/ICETOOL 6 Wed Feb 22, 2017 10:44 pm


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