Comparing Decimal Numbers

Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS
Subha
Posts: 6
Joined: Sat Apr 05, 2008 8:19 am
Skillset: COBOL, VSAM, DB2
Referer: friends

Re: Comparing Decimal Numbers

Postby Subha » Mon Apr 07, 2008 9:47 pm

Thanks for your suggestion.

CICS Guy
Posts: 246
Joined: Wed Jun 20, 2007 4:08 am

Re: Comparing Decimal Numbers

Postby CICS Guy » Mon Apr 07, 2008 9:49 pm

Does this come close to what you are looking for?
N1 contains five records:

Code: Select all

0000033.32
0000041.47
0000100.01
0000050.12
0000000.02
N2 contains five records:

Code: Select all

000000044.470
000000109.230
000000300.000
000000020.010
000000050.990
I would like to know how to compare these two files on a one to one basis and write the record with the greater variable into an Output file through Cobol program.
My expeced output will look like this:

Code: Select all

000000044.470
000000109.230
000000300.000
0000050.12
000000050.990

Subha
Posts: 6
Joined: Sat Apr 05, 2008 8:19 am
Skillset: COBOL, VSAM, DB2
Referer: friends

Re: Comparing Decimal Numbers

Postby Subha » Tue Apr 08, 2008 8:49 pm

No the data is not preceded by zero. It is as I have mentioned. In a file layout , the numeric portion of the number is preceded by spaces and not zeros.

User avatar
dick scherrer
Global moderator
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am

Re: Comparing Decimal Numbers

Postby dick scherrer » Tue Apr 08, 2008 9:28 pm

Hello,

In a file layout , the numeric portion of the number is preceded by spaces and not zeros.
Is there some good reason that you continue to refuse to post the data "in a file layout"? Initially, it appeared as though you had a single file with multiple numbers in it. CG posted numbers in 2 files and you commented on the format of them, but not about having 2 files.

If your next reply does not show some data records "in a file layout" (quite similar to the sample i've already given), i'll either "lock" or delete this topic. People here are willing to help you, but you have to work with us. . . :cry:
Hope this helps,
d.sch.

CICS Guy
Posts: 246
Joined: Wed Jun 20, 2007 4:08 am

Re: Comparing Decimal Numbers

Postby CICS Guy » Tue Apr 08, 2008 9:48 pm

OK, trying again....
Does this come close to what you are looking for?
N1 contains five records:

Code: Select all

     33.32
     41.47
    100.01
     50.12
      0.02
N2 contains five records:

Code: Select all

       44.470
      109.230
      300.000
       20.010
       50.990
I would like to know how to compare these two files on a one to one basis and write the record with the greater variable into an Output file through Cobol program.
My expeced output will look like this:

Code: Select all

       44.470
      109.230
      300.000
     50.12
       50.990

Or this:

Code: Select all

000000044.470
000000109.230
000000300.000
0000050.12
000000050.990


  • Similar Topics
    Replies
    Views
    Last post