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

Suppressing the INVALIS CHARS in a string


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Kamlesh Kamal

New User


Joined: 16 May 2008
Posts: 36
Location: Kolkata,India

PostPosted: Mon Jul 27, 2009 2:10 pm
Reply with quote

Hi ,

I am getting values in my report file as . . AND . . MUT FUND my requirement is to supress these.

Like for . . I should have spaces and for . .MUT FUND I should get only MUT FUND

I have tried checking for NULL VALUES ,LOW AND HIGH VALUES but that didn't work.The hex equivalent for the first byte is 00 and for the second is 1E(which measns a record separator in CHAR)

Can anyone tell me how can I suppress it?The value is as under

PROD TYP CD
.. should be spaces here
.. should be spaces here
..MUT FUND should be MUT FUND here like below
MUT FUND
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Mon Jul 27, 2009 4:55 pm
Reply with quote

Is the data coming in from the input file with the invalid values, or are the invalid values only showing up in the output file? If the data is coming in bad, you need to go to whatever process is generating the file and clean up the data there. If your program is generating the bad data, you need to figure out why and change your code to stop doing so.
Back to top
View user's profile Send private message
Kamlesh Kamal

New User


Joined: 16 May 2008
Posts: 36
Location: Kolkata,India

PostPosted: Mon Jul 27, 2009 5:10 pm
Reply with quote

The data is coming from set of tables and that particular field is populated with that kind of value in the table itself.But my requirement is to populate it without those invalid values in my report that I am generating from those tables
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Mon Jul 27, 2009 5:55 pm
Reply with quote

Are the only two bad characters hex '00' and hex '1E'? If so, use reference modification to scan each byte of the field for one of the bad characters and if it is bad, replace it with a space. If there are other values that are not valid, your IF statement could become long.
Back to top
View user's profile Send private message
Kamlesh Kamal

New User


Joined: 16 May 2008
Posts: 36
Location: Kolkata,India

PostPosted: Mon Jul 27, 2009 6:27 pm
Reply with quote

Yes, there are only two bad characters hex "00" and "1E" but can u plz elaborate on how to use the reference modification for scanning the string..and replacing them?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Mon Jul 27, 2009 6:28 pm
Reply with quote

There is a manuals link at the top of the page. Use it to find the COBOL Language Reference manual and do a search in it for reference modification.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Mon Jul 27, 2009 8:41 pm
Reply with quote

or you can use INSPECT:
Code:
INSPECT WS-FIELD REPLACING ALL LOW-VALUE BY SPACE
INSPECT WS-FIELD REPLACING ALL X'1E' BY SPACE
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Tue Jul 28, 2009 6:54 am
Reply with quote

If there are a lot of them, use the CONVERTING version of INSPECT. I understand it's faster and it can be done with one statement instead of two.
Back to top
View user's profile Send private message
Kamlesh Kamal

New User


Joined: 16 May 2008
Posts: 36
Location: Kolkata,India

PostPosted: Tue Jul 28, 2009 12:34 pm
Reply with quote

Hi,

Thanks so much for your continued help on this problem.This is really critical for me as I have to deliver this piece of code ASAP.

The first inspect worked fine and the first invalid char of "00" in the form of dot was removed however the second one of "1E" is still there as I am getting a compilation error when I use that inspect.

I am attaching the screenshot for the same.Guess the letter X is not recognized.its taken just as a varible and hence the error.

I just tried giving the inspect as INSPECT EGA-NES-PROD-TYP-CD REPLACINGALL '1E' BY SPACE. It didn't work understandably
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue Jul 28, 2009 12:41 pm
Reply with quote

please do not post screenshots...
not everybody can see them
it's a waste of space

but the proper approch would be to understand and fix the program which builds the dataset

if the dataset has a fixed layout it would be easier and faster simply to
rebuild the output records with some MOVE' s
Back to top
View user's profile Send private message
Kamlesh Kamal

New User


Joined: 16 May 2008
Posts: 36
Location: Kolkata,India

PostPosted: Tue Jul 28, 2009 12:45 pm
Reply with quote

The reference modification too won't work as its not fixed how many invalid characters of "1E' would be there in the DS.Like I can have four DOTS followed by the value .example : . . . . MUT FUND
Back to top
View user's profile Send private message
Kamlesh Kamal

New User


Joined: 16 May 2008
Posts: 36
Location: Kolkata,India

PostPosted: Tue Jul 28, 2009 1:50 pm
Reply with quote

Thanks guys..

Got it fixed....using the inspect only ..just had to declare a class in the SPECIAL NAMES under the config section of my program.
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 -> COBOL Programming

 


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 file manager is doing string conversion IBM Tools 3
No new posts Search string in job at regular Spool... CLIST & REXX 0
Search our Forums:

Back to Top