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
 

 

Nonprintable characters in file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
anil_jdh

New User


Joined: 05 Apr 2006
Posts: 4

PostPosted: Fri Feb 09, 2007 5:54 pm    Post subject: Nonprintable characters in file
Reply with quote

A COBOL program is reading a file and printing it but the file contains some nonprintable characters. How to locate those nonprintable characters and replace them with spaces.
Back to top
View user's profile Send private message

William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Fri Feb 09, 2007 6:15 pm    Post subject: Re: Nonprintable characters in file
Reply with quote

anil_jdh wrote:
A COBOL program is reading a file and printing it but the file contains some nonprintable characters. How to locate those nonprintable characters and replace them with spaces.
You have three possibilities:
You know what the unprintable character is but not where;
You know where the unprintable character is but not what;
You don't know where or what the unprintable character is.
The first case is a simple INSPECT CONVERTING and the second is a simple move. The third will need a byte-by-byte scan thru the data testing every byte for "printableness" or "unprintableness".
Have fun.... icon_biggrin.gif
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: Fri Feb 09, 2007 9:56 pm    Post subject:
Reply with quote

Hello,

If you can look at the file in tso/browse or view, you can find the "unprintable" characters by typing "find p'.' " in the command area and pressing enter. The editor will move the sursor from one unprintable character to the next.

If the file is too large to look at, use a utility to create a small set of the data and then look at that.

Once you know what kind of "unprintables" you are dealing with, you can code for them.
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Fri Feb 09, 2007 11:06 pm    Post subject: Re: Nonprintable characters in file
Reply with quote

Wouldn't one just need to check for data transparency?
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Fri Feb 09, 2007 11:15 pm    Post subject: Re: Nonprintable characters in file
Reply with quote

superk wrote:
Wouldn't one just need to check for data transparency?
Yes, sure..... icon_confused.gif BTW, what means "data transparency" and how would I do it?
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Sat Feb 10, 2007 2:16 am    Post subject: Re: Nonprintable characters in file
Reply with quote

When EBCDIC data is transparent (i.e. non-displayable), it contains hex values less than a blank (x'40'). I guess I was wondering if each byte of data could be checked for a hex value < x'40', and then translated to x'40' if detected.
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: Sat Feb 10, 2007 2:33 am    Post subject:
Reply with quote

Hello,

There are also the 'unprintable' values above x'40' - for example x'61' or x'AA' or x'FE' etc.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Mon Feb 12, 2007 12:41 am    Post subject:
Reply with quote

This solution might be a little tedious, but it should work fine. Using the link below create an INSPECT stmt with a sending string that contains the hex values of each non-displayable char you want to replace with a space.

The hex values you can get from the link below, for e.g.:

The chart shows that X'00' thru X'39', X'80', X'90', X'9A thru X'A0', and so on are not displayable. You would have to code the INSPECT stmt something like this:

INSPECT YOUR-REC CONVERTING X'00010203...3980909A9B9C...9E9FA0...' TO 'bbb...bbbb...'

The (...) above exposes my laziness [you'll have to fill in the (...) and the blanks (b)]. Note that the number of blanks coded in the receiving field must EQUAL the number of 2 digit hex values coded in the sending field.

BTW, you can use X'4040...40' in the receiving field. Also, don't use a variable to define the fields, make them in-line literals; it's much more efficient (only one assembler instr).

You can also blank any obscure printables from the record.

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/handheld/Connected/BOOKS/IGY3LR10/APPENDIX1.3.1
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 SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm


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