Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 213
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: 7314

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 USS: Find and replace string within a... vasanthz All Other Mainframe Topics 5 Thu Aug 02, 2018 4:01 am
No new posts Add Comma to each record until find t... naveensrimf DFSORT/ICETOOL 6 Sat Jul 28, 2018 12:25 am
No new posts RACF- How to find the Last access of ... rahul shanmuganatan All Other Mainframe Topics 7 Thu Jun 21, 2018 3:19 pm
This topic is locked: you cannot edit posts or make replies. Rexx code to find greater then symobl... Bharath Vikraman CLIST & REXX 8 Tue May 29, 2018 9:40 am
No new posts Find & Replace string in CA-SORT mrgnndhmk CA Products 1 Fri Mar 30, 2018 12:58 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us