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

HEX VALUES


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

Active User


Joined: 02 Dec 2003
Posts: 150
Location: Tokyo, Japan

PostPosted: Fri Dec 05, 2003 7:19 am
Reply with quote

What is the difference between Character and HEX Values.

We have an address field X(32). It may contain proper value or some junk like X'0000'. We need to seperate out those records having junk values in the Address field.

Your help will be appreciated.

Regards,
Sandip.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Mon Dec 08, 2003 1:11 pm
Reply with quote

Hi Sandip,

Check out the CLASS clause in the SPECIAL-Names pgraph of the CONFIGURATION SECTION of the ENVIRONMENT DIVISION.

You can create a CLASS that contains all the chars that you deem acceptable. Then, in the proc div you can code a CLASS test to determine that your 32 byte field only contains those acceptable chars.

Example: Define a CLASS as "ACCEPTABLE"

In the proc div, code:
Code:

IF FLD-32 IS ACCEPTABLE
    PERFORM PROCESS-FLD
ELSE
    PERFORM BY-PASS-FLD
END-IF

One cautionary note. When using the THRU feature in defining the CLASS, remember that 'A' THRU 'Z' defines all chars with bit configurations between X'C1' and X'E9'. That means that there are gaps between "I" and "J", "R" and "S" that contain values that are not alphabetic.

Take a look at Appendix B of the COBOL Reference Manual. It contains the EBCDIC & ASCII collating sequences, you'll see what I mean.

Regards, Jack.
Back to top
View user's profile Send private message
sandip_datta

Active User


Joined: 02 Dec 2003
Posts: 150
Location: Tokyo, Japan

PostPosted: Mon Dec 08, 2003 1:26 pm
Reply with quote

Hi Jack,

It may seem to be ridiculas to you but I don't know the possible junk characters in the field.

Regards,
Sandip.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Wed Dec 10, 2003 12:42 pm
Reply with quote

Hi Sandip,

Do you know what the valid chars can be?

Regards, Jack.
Back to top
View user's profile Send private message
sandip_datta

Active User


Joined: 02 Dec 2003
Posts: 150
Location: Tokyo, Japan

PostPosted: Tue Dec 16, 2003 6:29 pm
Reply with quote

Hi Jack,

It may be anything A-Z, a-z, 0-9.

Regards,
Sandip.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Thu Dec 18, 2003 3:38 am
Reply with quote

Hi Sandip,

Try this:
Code:

        ENVIRONMENT DIVISION.
        SPECIAL NAMES.
            ACCEPTABLE IS
                '0' THRU '9'
                'A' 'B' 'C' 'D' 'E' 'F' 'G' 'H' 'I' 'J' 'K' 'L' 'M'
                'N' 'O' 'P' 'Q' 'R' 'S' 'T' 'U' 'V' 'W' 'X' 'Y' 'Z'
                'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm'
                'n' 'o' 'p' 'q' 'r' 's' 't' 'u' 'v' 'w' 'x' 'y' 'z'.


Use the PROC DIV code I listed in a previous post. The IF stmt will PERFORM the code that will process the field if it ONLY contains the chars listed above. If your testing shows that the list doesn't contain ALL the acceptable chars just expand the list.

Regards, Jack.
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 how to eliminate null indicator value... DB2 7
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Null values are considered in Total c... DFSORT/ICETOOL 6
No new posts Converting ASCII values to COMP-3 (ZD... JCL & VSAM 2
Search our Forums:

Back to Top