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
 

 

Handle junk values not readable by COBOL
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Handle junk values not readable by COBOL
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    Post subject: Re: How to handle junk values
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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: 7913
Location: Bellevue, IA

PostPosted: Tue Jul 13, 2010 5:56 pm    Post subject:
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    Post subject:
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    Post subject:
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: 7913
Location: Bellevue, IA

PostPosted: Tue Jul 13, 2010 6:07 pm    Post subject:
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    Post subject:
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    Post subject:
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: 2150
Location: At my coffee table

PostPosted: Tue Jul 13, 2010 6:23 pm    Post subject:
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    Post subject:
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: 7913
Location: Bellevue, IA

PostPosted: Tue Jul 13, 2010 7:03 pm    Post subject:
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: 2502
Location: Atlanta, Georgia, USA

PostPosted: Tue Jul 13, 2010 8:16 pm    Post subject: Reply to: How to handle junk values
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.

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

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

Site Director


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

PostPosted: Tue Jul 13, 2010 8:16 pm    Post subject:
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
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm
No new posts Overlaying one set of charater values... Kevin Lindsley SYNCSORT 7 Sat Nov 05, 2016 3:21 am
No new posts Regarding COBOL Stored Procedure opti... selvamsrinivasan85 DB2 4 Fri Nov 04, 2016 8:57 pm
No new posts COBOL Version 6.1 Virendra Shambharkar COBOL Programming 5 Tue Nov 01, 2016 11:24 am
No new posts Cobol list of programs being called biswajit.dattagupta COBOL Programming 5 Tue Nov 01, 2016 2:10 am


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