IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

find and replace characters in a string


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
V S Amarendra Reddy

Active User


Joined: 13 Sep 2006
Posts: 216
Location: USA

PostPosted: Sun Aug 04, 2013 5:03 am
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Sun Aug 04, 2013 5:17 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts Substring number between 2 characters... DFSORT/ICETOOL 2
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
Search our Forums:

Back to Top