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: 189
Location: INDIA

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: 7306

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 Replacing same string with different ... vickey_dw DFSORT/ICETOOL 6 Wed Feb 22, 2017 10:44 pm
No new posts Count Trailing Spaces in variable str... Virendra Shambharkar SYNCSORT 10 Thu Feb 02, 2017 12:23 pm
No new posts Remove junk values in a file and rite... KP1125 DFSORT/ICETOOL 2 Wed Jan 25, 2017 9:58 pm
No new posts find particular member name in PDS us... ravi243 CLIST & REXX 10 Mon Dec 19, 2016 6:44 pm
No new posts How to find the first monday of the w... abdulrafi COBOL Programming 10 Fri Nov 25, 2016 3:24 pm


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