View previous topic :: View next topic
|
Author |
Message |
Kamlesh Kamal
New User
Joined: 16 May 2008 Posts: 36 Location: Kolkata,India
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
Kamlesh Kamal
New User
Joined: 16 May 2008 Posts: 36 Location: Kolkata,India
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
Kamlesh Kamal
New User
Joined: 16 May 2008 Posts: 36 Location: Kolkata,India
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
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 |
|
|
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1249 Location: Richfield, MN, USA
|
|
|
|
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 |
|
|
Kamlesh Kamal
New User
Joined: 16 May 2008 Posts: 36 Location: Kolkata,India
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
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 |
|
|
Kamlesh Kamal
New User
Joined: 16 May 2008 Posts: 36 Location: Kolkata,India
|
|
|
|
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 |
|
|
Kamlesh Kamal
New User
Joined: 16 May 2008 Posts: 36 Location: Kolkata,India
|
|
|
|
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 |
|
|
|