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
 

 

Suppressing the INVALIS CHARS in a string

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Suppressing the INVALIS CHARS in a string
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: 8118
Location: East Dubuque, Illinois, USA

PostPosted: Mon Jul 27, 2009 4:55 pm    Post subject:
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    Post subject: Reply to: Suppressing the INVALIS CHARS in a string
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: 8118
Location: East Dubuque, Illinois, USA

PostPosted: Mon Jul 27, 2009 5:55 pm    Post subject:
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    Post subject: Reply to: Suppressing the INVALIS CHARS in a string
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: 8118
Location: East Dubuque, Illinois, USA

PostPosted: Mon Jul 27, 2009 6:28 pm    Post subject:
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: 1232
Location: Israel

PostPosted: Mon Jul 27, 2009 8:41 pm    Post subject:
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    Post subject:
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    Post subject: Reply to: Suppressing the INVALIS CHARS in a string
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10274
Location: italy

PostPosted: Tue Jul 28, 2009 12:41 pm    Post subject: Reply to: Suppressing the INVALIS CHARS in a string
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    Post subject:
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    Post subject: Reply to: Suppressing the INVALIS CHARS in a string
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming 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 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
This topic is locked: you cannot edit posts or make replies. Checking wether a string starts from ... sundaram.naveen CLIST & REXX 9 Thu Oct 06, 2016 11:56 am
No new posts Random Password (in string format) ge... ezhavendhan COBOL Programming 10 Mon Aug 29, 2016 3:18 pm


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