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
 

 

Comparing HEXADECIMAL values from two different files
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
feellikeneo

New User


Joined: 19 Mar 2007
Posts: 73
Location: Chennai

PostPosted: Wed Aug 01, 2007 7:30 pm    Post subject: Comparing HEXADECIMAL values from two different files
Reply with quote

Hi all,,

I have something odd to do..
I need to read hexadecimal value from two different files and compare those and carry out some operations.

When I use the below code,
Code:
01 WS-VARIABLE.
   05 WS-CONTOKEN1   PIC X(10).
   05 WS-CONTOKEN1   PIC X(10).


I end up in reading some junk values from those two files. So my IF condition always fails. Is there any ways to read the hexadecimal values in my COBOL code and compare those.

Basically those variables file will be something like this "º_ ±Õò"
So how can I proceed to read this from the file.

Please help me,

Cheers,
Neo icon_smile.gif
Back to top
View user's profile Send private message

feellikeneo

New User


Joined: 19 Mar 2007
Posts: 73
Location: Chennai

PostPosted: Wed Aug 01, 2007 7:34 pm    Post subject:
Reply with quote

Hi All,

To be more clear,

This is the value that is in the file - "º_ ±Õò"

And I tried displaying this in the COBOL as soon as I read the file and this was the value displayed - " ³6; A "


I dono what is causing this mismatch. I have used PIC X(10) in my COBOL.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Wed Aug 01, 2007 7:48 pm    Post subject:
Reply with quote

The code set used for the display that you view probably does not handle it the same as whatever utility you use to display the file. Always display the hex values. What you are seeing are the printable/displayable sets.
Back to top
View user's profile Send private message
feellikeneo

New User


Joined: 19 Mar 2007
Posts: 73
Location: Chennai

PostPosted: Wed Aug 01, 2007 7:58 pm    Post subject:
Reply with quote

Hi Brenholtz ,

My code/logic does not require to display what is in the file. I just need to compare.

I have put that piece of information just for the understanding.
Appreciate if you can explain more.

Cheers,
Neo icon_smile.gif
Back to top
View user's profile Send private message
William Thompson

Global Moderator


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

PostPosted: Wed Aug 01, 2007 8:07 pm    Post subject:
Reply with quote

3.4 browse the file and set hex on.....
In your program, define the value to compare to as hex instead of character.....
Back to top
View user's profile Send private message
feellikeneo

New User


Joined: 19 Mar 2007
Posts: 73
Location: Chennai

PostPosted: Wed Aug 01, 2007 8:15 pm    Post subject:
Reply with quote

Hi William

Can you explain on more how to define the value to compare as a HEX character.

Sorry to keep you disturbing..

Thanks
Neo icon_smile.gif
Back to top
View user's profile Send private message
William Thompson

Global Moderator


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

PostPosted: Wed Aug 01, 2007 8:23 pm    Post subject:
Reply with quote

for example, your "º_ ±Õò" showed up as:
Code:
º_ ±Õò
9648EC
BD0FFD
so if you were going to compare a six byte filed that might or might not have "º_ ±Õò" in it,
Code:
01  test pic X(6) value X'9B6D408FEFCD'.
if file-field = test-field
   display 'EQUAL'.
Back to top
View user's profile Send private message
feellikeneo

New User


Joined: 19 Mar 2007
Posts: 73
Location: Chennai

PostPosted: Wed Aug 01, 2007 8:29 pm    Post subject:
Reply with quote

Hi william,

Sorry that I mislead you.
I may not be knowing this value "º_ ±Õò" until I read the first file.
and the one more field to compare with will come from another file.

I need to compare these two unknown variables.

Thanks a lot for your help
Back to top
View user's profile Send private message
William Thompson

Global Moderator


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

PostPosted: Wed Aug 01, 2007 8:46 pm    Post subject:
Reply with quote

As in?
Code:
If file1-field = file2-field
   display 'EQUAL'.
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: Wed Aug 01, 2007 8:46 pm    Post subject:
Reply with quote

Hello,

You need to look at both files in hex (as suggested above - do this in tso/ispf). When you have looked at the "same" data field a record in both files, post the hex values you see here and we can tell you more about your data. This investigation will not need your program to run.

When you post the values here, please use the "Code" tab at the top of the Reply Panel. Use copy/paste rather than typing the info. This will ensure your data is more readable. After you enter what you want to post, click Preview and ensure your post looks the way you want it to look.
Back to top
View user's profile Send private message
feellikeneo

New User


Joined: 19 Mar 2007
Posts: 73
Location: Chennai

PostPosted: Wed Aug 01, 2007 8:49 pm    Post subject:
Reply with quote

Yes I have to compare exactly like this,
Code:

If file1-field = file2-field
   display 'EQUAL'.


But the thing is that this IF condition always fails. Dono why?? icon_cry.gif

If I browse the file through 3.4 I see both the fields exactly same.
Back to top
View user's profile Send private message
feellikeneo

New User


Joined: 19 Mar 2007
Posts: 73
Location: Chennai

PostPosted: Wed Aug 01, 2007 9:01 pm    Post subject:
Reply with quote

This is the data from my file-1,

Code:
|      Âº_    Â±Ã•Ã² |
44129608EC44
F071BDEFFD0F


And this is the data in my file-2,

Code:
|      Âº_    Â±Ã•Ã² |
44129608EC44
F071BDEFFD0F


When I display the file-1 value using my COBOL code, (not able to find the hex chars for this as I am viewing this in the SPOOL)

Code:
   _   
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Wed Aug 01, 2007 9:05 pm    Post subject:
Reply with quote

How about showing us your data layout (working-storage) in your COBOL program. If indeed these are the same when you edit/view/browse them with HEX ON, then your address assignments for file1-field and file2-field are not what you think they are.
Back to top
View user's profile Send private message
feellikeneo

New User


Joined: 19 Mar 2007
Posts: 73
Location: Chennai

PostPosted: Wed Aug 01, 2007 9:11 pm    Post subject:
Reply with quote

This is my IF condition,

Code:
IF WS-CONTOKEN =               
    WS-ARRAY-CONTOKEN(RB-INDEX)


The WS-CONTOKEN variable is in FD section of file-1.

Code:
05 WS-CONTOKEN              PIC X(08).


The WS-ARRAY-CONTOKEN variable is declared as working storage variable in an array, (file-2 variable)

Code:
10 WS-ARRAY-CONTOKEN   PIC X(08).
Back to top
View user's profile Send private message
William Thompson

Global Moderator


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

PostPosted: Wed Aug 01, 2007 9:30 pm    Post subject:
Reply with quote

The basic truth, if both values are coming from file, don't do anything, just move the one to your array and compare the other to it....Who cares that it doesn't display right.....

IIRC, when in spool, hex on doesn't work, but set hex on does.....
Back to top
View user's profile Send private message
feellikeneo

New User


Joined: 19 Mar 2007
Posts: 73
Location: Chennai

PostPosted: Wed Aug 01, 2007 9:39 pm    Post subject:
Reply with quote

I am sorry that this doesn't work in my case.

I am just comparing these two values from file-1 and file-2 but still then my IF fails
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Wed Aug 01, 2007 9:41 pm    Post subject:
Reply with quote

William Thompson,
That is what he is doing. He is moving 8 bytes from someplace to some array position. and comparing one or another of the array positions to somplace in a FD record description

feellikeneo's addressing (relative locations) is wrong.

We need to see the complete records from the FD section and his move code to see where his addressing is incorrect............................

A side note; feellikeneo, not that it is completely necessary, but why are you working in the FD Record description entries and not from work-areas (i.e. why are you not using a workarea option with your reads)?
Back to top
View user's profile Send private message
socker_dad

Active User


Joined: 05 Dec 2006
Posts: 147
Location: Columbia, MO

PostPosted: Wed Aug 01, 2007 9:43 pm    Post subject: Re: Comparing HEXADECIMAL values from two different files
Reply with quote

Have you tried defining the fields as COMP and comparing?
Back to top
View user's profile Send private message
feellikeneo

New User


Joined: 19 Mar 2007
Posts: 73
Location: Chennai

PostPosted: Wed Aug 01, 2007 9:52 pm    Post subject:
Reply with quote

Hi Brenholtz ,

I tried moving both the values from file-1 to file-2 to working storage variable and then tried to compare. Still the same result.

Hi Socker_dad,
I tried COMP and sorry, no use
Back to top
View user's profile Send private message
socker_dad

Active User


Joined: 05 Dec 2006
Posts: 147
Location: Columbia, MO

PostPosted: Wed Aug 01, 2007 10:02 pm    Post subject: Re: Comparing HEXADECIMAL values from two different files
Reply with quote

OK, here's the my resort. Post your code and the file. Like this:

Code:
Code:

IF  AUDIT-D73                     
AND DL-AUDIT-SUSP-BATCH > SPACES 
   MOVE DL-AUDIT-SUSP-BATCH       
     TO CONSTANT-BATCHX.         


Copybook definition:
Code:

01  DL-AUDIT.                                                 
    02 DL-AUDIT-PGM-ID                               PIC X(03).
       88 MAINT-TO-FIXED-AREA       VALUE 'D50'.               
       88 DIVR                      VALUE 'D51'.               
       88 MAINTENANCE               VALUE 'D52' 'D53'.         
       88 MAINT                     VALUE 'D50' 'D52' 'D53'.   
       88 ISSUANCE-ENTRY            VALUE 'D25'.               
       88 INCIDENT-CONTROL-PGM      VALUE 'DES'.               
       88 SUSPENSION-REINSTATEMENT  VALUE 'D73' 'D35'.         
       88 FR-CERTS                  VALUE 'D92'.               
       88 CONVICTION-ACCIDENT       VALUE 'D43'.               
       88 COUNTY-CODE               VALUE 'D57'.               
       88 AUDIT-D53                 VALUE 'D53'.               
       88 AUDIT-D73                 VALUE 'D73'.               
...
02 DL-AUDIT-INPUT-SUSP-REIN-CD                   PIC X(01).
   88 SUSP-ENTRY                 VALUE ' ' 'K' 'X'.       
   88 REIN-ENTRY                 VALUE 'F' 'B' 'P' 'T'     
                                       'R' 'A' 'Q' '2'     
                                       '3' 'G' 'H' 'U'     
                                       '9' 'V' 'C'.       
02 DL-AUDIT-SUSP-BATCH                           PIC X(02).
02 DL-AUDIT-D56-FORCE-CODE1                      PIC X(01).


File:
Code:

 File-AID - Browse - MVD.MV603.D78XXXB2.INPUT.LTH656 ------
 COMMAND ===>                                             
 RECORD:     13                                           
 ---- FIELD LEVEL/NAME ------- COLUMNS- ----+----1----+----
 2 DL-AUDIT-PGM-ID                    1 D73               
 
...
 RECORD:     13                                   
 ---- FIELD LEVEL/NAME ------- COLUMNS- ----+----1-
 2 DL-AUDIT-SUSP-BATCH              110 K3         
 2 DL-AUDIT-D56-FORCE-CODE1         112           
 2 DL-AUDIT-ACCIDENT-BATCH-CD       113           


and the hexadecimal display for the same:
Code:

----+
D7300
CFFFF
47300
...
+----1----+---
     K3       
44444DF4444444
00000230000000
                                                                                   


Then we can see exactly with what we are dealing and make better informed suggestions.
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
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 8 Thu Dec 01, 2016 8:28 pm
No new posts Overlaying one set of charater values... Kevin Lindsley SYNCSORT 7 Sat Nov 05, 2016 3:21 am
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm
No new posts Comparing Decimal and CHAR columns rakesh17684 DB2 7 Thu Oct 20, 2016 2:33 am
No new posts Low values Results from VARCHAR FORMAT balaji81_k DB2 10 Thu Oct 20, 2016 1:18 am


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