How to get rid of the garbage characters.



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

How to get rid of the garbage characters.

Postby kihaho » Thu May 15, 2008 9:08 pm

Hi,
I have a file that contains garbage characters which is causing a hang in a batch job.
When I turn HEX on, it showed up as – CC
02
I believe it’s a carriage return.
What can I do to prevent this programmatically in the future.?
The field is defined as: PICX(60).

Thank you for your assistance.
kihaho
 
Posts: 19
Joined: Tue May 06, 2008 11:13 pm
Has thanked: 0 time
Been thanked: 0 time

Re: How to get rid of the garbage characters.

 

Re: How to get rid of the garbage characters.

Postby CICS Guy » Thu May 15, 2008 9:42 pm

kihaho wrote:I have a file that contains garbage characters which is causing a hang in a batch job.
When I turn HEX on, it showed up as – CC
02
I believe it’s a carriage return.
What can I do to prevent this programmatically in the future.?
The field is defined as: PICX(60).
You mean that there are two bytes of X'C0C2'? Or one byte of X'02'?
Multiple times? In the same location?

More info is needed, but why not prevent the program outputting the data to not output the 'garbage' in the first place?
Or, after reading the record, eliminate the garbage before processing it?
CICS Guy
 
Posts: 255
Joined: Wed Jun 20, 2007 4:08 am
Has thanked: 0 time
Been thanked: 0 time

Re: How to get rid of the garbage characters.

Postby kihaho » Fri May 16, 2008 10:08 pm

Hi CICS guy,
Thank you for the reply.
Here is my answer to your question.

You mean that there are two bytes of X'C0C2'? Or one byte of X'02'?
Multiple times? In the same location?

It's x'C0C2'.(2 bytes)

More info is needed, but why not prevent the program outputting the data to not output the 'garbage' in the first place?
Or, after reading the record, eliminate the garbage before processing it?CICS Guy

I'd like to know how to eliminate the garbage characters after reading the record, before processing it, please.
Thank you!!!
Posts: 218
Joined: Tue Jun 19, 2007 5:38 pm
Private message
kihaho
 
Posts: 19
Joined: Tue May 06, 2008 11:13 pm
Has thanked: 0 time
Been thanked: 0 time

Re: How to get rid of the garbage characters.

Postby dick scherrer » Sat May 17, 2008 12:40 am

Hello,

First, you have to identify all of the possible "garbage" characters.

Then, in your code (after the read and before usng the data) INSPECT the input data converting the "garbage" to whatever you want to use instead.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: How to get rid of the garbage characters.

Postby CICS Guy » Sat May 17, 2008 2:31 am

kihaho wrote:I'd like to know how to eliminate the garbage characters after reading the record, before processing it,
Again, do they appear multiple times? In the same location? Do you want to replace them with any particular value or have them 'squeezed' out of the record with trailing characters 'slid' forward?
CICS Guy
 
Posts: 255
Joined: Wed Jun 20, 2007 4:08 am
Has thanked: 0 time
Been thanked: 0 time

Re: How to get rid of the garbage characters.

Postby kihaho » Tue May 20, 2008 6:48 pm

Hi Dick and CICS guy,
Thank you so much for your advice.
To answer your question, the value of the garbage character is always the same(x'C0C2').
But the location of this item changes all the time. The reason is that it’s PIC X(70) free form field.
People enter an accident description, so the length of the description differs every time. Therefore, the location of the garbage characters is somewhere in the 70bytes field and fluctuates.

As Dick suggested, I am going to put the Inspect statement after the record is read and before it’s processed:

Inspect Accident-description replacing all X’C0C2’ by spaces.

Is this right?
Thank you so much again!!
kihaho
 
Posts: 19
Joined: Tue May 06, 2008 11:13 pm
Has thanked: 0 time
Been thanked: 0 time

Re: How to get rid of the garbage characters.

Postby CICS Guy » Tue May 20, 2008 7:13 pm

kihaho wrote:Inspect Accident-description replacing all X’C0C2’ by spaces.
Is this right?
Looks good....
INSPECT statement
CICS Guy
 
Posts: 255
Joined: Wed Jun 20, 2007 4:08 am
Has thanked: 0 time
Been thanked: 0 time

Re: How to get rid of the garbage characters.

Postby kihaho » Tue May 20, 2008 7:28 pm

Thank you again, so much!!!
You guys always deliver good!!
kihaho
 
Posts: 19
Joined: Tue May 06, 2008 11:13 pm
Has thanked: 0 time
Been thanked: 0 time

Re: How to get rid of the garbage characters.

Postby dick scherrer » Wed May 21, 2008 12:02 am

You're welcome :)

Is the INSPECT now working for you?

d
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: How to get rid of the garbage characters.

Postby kihaho » Tue Jul 08, 2008 7:18 pm

Sorry for the delay on my reply.
Yes, the "inspect" is working beautifully!
Thank you again!!!
kihaho
 
Posts: 19
Joined: Tue May 06, 2008 11:13 pm
Has thanked: 0 time
Been thanked: 0 time

Next

Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post