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

Handle junk values not readable by COBOL


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

New User


Joined: 20 Dec 2007
Posts: 54
Location: Hyderabad

PostPosted: Tue Jul 13, 2010 5:12 pm
Reply with quote

I have a file that is transferred from a non-mainframe system to a mainframe system. When the characters in ASCII are transitioned to EBCDIC format, spaces (HEX '40') are getting converted to junk values (HEX '05') which is not readable by COBOL.

Is there any way to handle this in cobol.

Please let me know if you need more info.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Tue Jul 13, 2010 5:21 pm
Reply with quote

surya anem wrote:
I have a file that is transferred from a non-mainframe system to a mainframe system. When the characters in ASCII are transitioned to EBCDIC format, spaces (HEX '40') are getting converted to junk values (HEX '05') which is not readable by COBOL.

Is there any way to handle this in cobol.

Please let me know if you need more info.


X'05' is a TAB character and can be read by COBOL with no trouble (as can any of the other 255 possible EBCDIC characters), I would suggest you look somewhere else for your problem. X'40' would not be an ASCII space that would be a x'20'!
Back to top
View user's profile Send private message
surya anem

New User


Joined: 20 Dec 2007
Posts: 54
Location: Hyderabad

PostPosted: Tue Jul 13, 2010 5:33 pm
Reply with quote

Please see below the field that is being said as invalid when it is viewed through file-aid. If you can detect any, it would be of great help.

Code:

Novello Dan N. Current Account                                                 
D9A89990C894D44CA9989A4C889A9A44444444444444444444444444444444444444444444444444
5655336541505B034995530133645300000000000000000000000000000000000000000000000000
-------------------------------------------------------------------------------
Novello Dan N. Current Account                                                 
D9A89990C894D44CA9989A4C889A9A44444444444444444444444444444444444444444444444444
5655336541505B034995530133645300000000000000000000000000000000000000000000000000
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Jul 13, 2010 5:36 pm
Reply with quote

surya anem,

since we have no idea of the field definitions, what you posted above is useless.
Back to top
View user's profile Send private message
surya anem

New User


Joined: 20 Dec 2007
Posts: 54
Location: Hyderabad

PostPosted: Tue Jul 13, 2010 5:40 pm
Reply with quote

This is just one field
WS-NAME PIC X(108)

I just posted the beginning portion of the field that has data. rest of them were spaces (HEX '40')
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Tue Jul 13, 2010 5:41 pm
Reply with quote

I don't see a x'05' anywhere in that data, all I see are EBCDIC characters, mostly spaces x'40'. What is the definition of the field, which field is INVALID?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Jul 13, 2010 5:42 pm
Reply with quote

well, a pic x can not contain invalid characters.

you need to explain your problem.

saying you have junk characters only tells us that you have no idea what is going on.

the must be a file definition.
what about the file does not follow the definition?
Back to top
View user's profile Send private message
surya anem

New User


Joined: 20 Dec 2007
Posts: 54
Location: Hyderabad

PostPosted: Tue Jul 13, 2010 5:46 pm
Reply with quote

The data i posted is value of field WS-NAME PIC X(108) in 2 records (1 above line and 1 below line) when viewed in file-aid with HEX ON.

Please see the hex value for the space between Novello and Dan.

I hope i am clear now. if still not, plz let me know.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Jul 13, 2010 5:51 pm
Reply with quote

use inspect replacing in your cobol program,
or pre-process the file with a sort
to change the 05 to 40, a space.

what is the problem?

if there is an FTP problem, you need to check with your support people.

and it is possible, that there was an ASCII tab character in the original file prior to the transfer?
sorta depends on how the ASCII file was generated.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Tue Jul 13, 2010 5:56 pm
Reply with quote

Quote:
I hope i am clear now. if still not, plz let me know.
You are about as clear as mud.

What are the symptoms of your problem? Do you get an error message? Do you get an abend? If no error message or abend, how do you know you have a problem at all? Are you trying to read this data in a file? Are you getting a file status code? and if so, which file status code? What do you want done with the TAB (X'05') characters? Are there any other characters causing you problems? What do you want done with these characters? How does the data get to the mainframe?

You've pretty much provided no data to us so far -- you need to answer every one of these questions to get realistic, accurate answers from us!
Back to top
View user's profile Send private message
surya anem

New User


Joined: 20 Dec 2007
Posts: 54
Location: Hyderabad

PostPosted: Tue Jul 13, 2010 6:00 pm
Reply with quote

We recieve this file from non-mainframe through FTP.

the problem is when i view this file through file aid (with hex off) only this field is being displayed as invalid rest all look fine.

As you pointed, i am not exactly sure why this is happening. I just want to know if there is any specific reason for this and any ways i can handle this to prevent this invalid values (which i guess are non-ebcdic characters that got into file during FTP) from being passed on to next step.

So i just want to filter this out and populate only valid values.

I suspected this HEX '05' because rest of the spaces are coming as HEX '40'
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Tue Jul 13, 2010 6:06 pm
Reply with quote

I am sorry there is a x'05' character in there but cobol can handle that with no trouble. What program is saying that the field is invalid, what is causing it to say it is invalid? Please tell us something other then you don't know what you are doing.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Tue Jul 13, 2010 6:07 pm
Reply with quote

The easiest answer: DO NOT USE FILE AID TO VIEW THE FILE.

You have not indicated any problem with any program actually using this data -- just viewing it via File Aid. So don't view it and end of issue.

Quote:
So i just want to filter this out and populate only valid values.
This is a WRONG statement. A computer cannot have invalid values in a data byte -- every possible character of the collating sequence (256 in EBCDIC) is valid. You are thinking there is a problem when there is not one -- it is merely the way File Aid attempts to handle the data; don't use File Aid and you won't see the problem any more.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Jul 13, 2010 6:14 pm
Reply with quote

I doubt that file-aid would call the contents of an pic x field invalid,
unless there is a way to tell file-aid to only consider 'printable char'.

do the records of this file only contain 1 field?
what other fields make up the record.

Besides, it appears that the x'05' would be a handy delimiter to separate the last name from the first in an UNSTRING operation.
Back to top
View user's profile Send private message
surya anem

New User


Joined: 20 Dec 2007
Posts: 54
Location: Hyderabad

PostPosted: Tue Jul 13, 2010 6:17 pm
Reply with quote

Thats a good solution. But i was just trying to understand why and what values does file-aid considers invalid in an ALPHANUMERIC field for viewing.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Tue Jul 13, 2010 6:23 pm
Reply with quote

surya anem wrote:
Thats a good solution. But i was just trying to understand why and what values does file-aid considers invalid in an ALPHANUMERIC field for viewing.
Could you please copy&paste the entire FileAid screen that is posting the 'invalid' message?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Jul 13, 2010 6:48 pm
Reply with quote

surya anem wrote:

Thats a good solution. But i was just trying to understand why and what values does file-aid considers invalid in an ALPHANUMERIC field for viewing.


now I understand, you want us to teach you file-aid...
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Tue Jul 13, 2010 7:03 pm
Reply with quote

In my experience, File Aid only identifies invalid data when you have a NUMERIC (not alphanumeric) variable in a copy book where the data does not match the specification. Of course, if the TAB character is supposed to represent a given number (4? 5? 8?) of spaces, that could cause the rest of the record to not match the copy book.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Tue Jul 13, 2010 8:16 pm
Reply with quote

In the following link, review the building of the FROM and TO translate tables, followed by an INSPECT and see if this will work for you.

ibmmainframes.com/viewtopic.php?p=143786&highlight=#143786

Bill
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19243
Location: Inside the Matrix

PostPosted: Tue Jul 13, 2010 8:16 pm
Reply with quote

Hello,

If you are trying to view the data in file-aid using a file layout (copybook), suggest you look at the file without this.

The process that created the file placed a tab delimiter between the "lastname" the the first part of the name. I suspect you may need to handle this rather than simply changing the tab to a space - depending on the "rules".
Back to top
View user's profile Send private message
Kjeld

Active User


Joined: 15 Dec 2009
Posts: 365
Location: Denmark

PostPosted: Thu Jul 15, 2010 1:28 pm
Reply with quote

surya anem wrote:
Thats a good solution. But i was just trying to understand why and what values does file-aid considers invalid in an ALPHANUMERIC field for viewing.

FileAid informs you that it has found characters that will not display on the screen, because no printable character exists in the screen character set. So will ISPF Browse and other file viewer appplications to warn you that what you see on screen is not what you have in your file.
Back to top
View user's profile Send private message
haiardhan

New User


Joined: 26 Jul 2008
Posts: 7
Location: india

PostPosted: Wed Apr 24, 2013 5:03 pm
Reply with quote

Hi guys i understood the problem what question is :

x'05' can not shown any value ... not even spaces(x'40')

x'05' is happend to be appear becuase of typo mistake of user.... when he enter the data ... by accidently he might have entered alt+'some key'

hense the data is showing like as he posted.

SWL.I.S..TRFT.SRM.15
EED0C4E40EDCE0EDD0FF
26359B2B539635294515[/b]
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Wed Apr 24, 2013 5:54 pm
Reply with quote

haiardhan, nice of you to join the discussion two years and nine months late ....

Quote:
x'05' is happend to be appear becuase of typo mistake of user
And, actually, this statement is wrong. If you find the 037 code page for EBCDIC, you will find that X'05' is described as HT (also known as horizontal tab). It is possible, for example, to take data from a PC to a mainframe and have X'05' characters show up without being keyed -- for example, an iTunes export file uses X'05' to separate fields and to align data vertically.
Back to top
View user's profile Send private message
haiardhan

New User


Joined: 26 Jul 2008
Posts: 7
Location: india

PostPosted: Wed Jun 12, 2013 4:41 pm
Reply with quote

Robert....

I hope surya was giving you a data which is having problem...with x'05' in between the two words of a record.

The data is something like below

OWEN.SLIDE SANDAL
DECD0EDCCC4ECDCCD4
665552394502154130



The junk here is the dot between owen and slide 'OWEN.SLIDE'
which is a junk value of equivalent of hex '05'

please check the below attached for the exact problem to understand.




[/img][/url]
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Wed Jun 12, 2013 5:17 pm
Reply with quote

haiardhan: a few points you need to consider:

1. surya's last post was July 2011. While surya may still be lurking, it is also entirely possible you are providing advice to someone who stopped reading posts 21 months before you posted.

2. there is no such thing as a "junk value" -- period. Each and every character in the collating sequence has a purpose, if nothing else than to complete the collating sequence. Talking about "junk values" indicates that you have ABSOLUTELY no knowledge of computers, OR that your thinking is so sloppy that anything you post is suspect, automatically.

3. as I posted before, the X'05' character represents a tab character. It can be used in TSO/ISPF edit sessions as well as come to a mainframe from a PC in a text file.

4. do not post attachments -- many on this forum cannot download them due to company restrictions, so you are significantly reducing your audience when you post an attachment.

5. what are you trying to say, anyway? If you want to say that X'05' is not a valid character on a 3270 screen, so what? It can still be placed on a screen and it is still not a "junk value".
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 COBOL sorting, with input GDG base COBOL Programming 7
No new posts Need help with ADABAS query (COBOL-AD... All Other Mainframe Topics 0
No new posts Replacing FILLER with FILLER<SeqNu... DFSORT/ICETOOL 2
No new posts how to eliminate null indicator value... DB2 7
No new posts Compile Sp Cobol base COBOL Programming 1
Search our Forums:

Back to Top