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
 

 

Compare PD Values with same storage & diff decimal locat

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
Shrinika Rajendran

New User


Joined: 06 Jun 2013
Posts: 25
Location: India

PostPosted: Wed Nov 05, 2014 3:17 pm    Post subject: Compare PD Values with same storage & diff decimal locat
Reply with quote

Hi,
For comparing two PD vales that occupy same storage but having decimal point located at different places like below
Code:
01 WS-RECORD.                                   
  05 AMT1                 PIC S9(2)V9(2) COMP-3.
  05 AMT2                 PIC S9(3)V9(1) COMP-3.

Is it only possible to have it expanded using Edit mask and then compare like below?
Code:
SORT FIELDS=COPY                                           
INREC FIELDS=(1,3,PD,EDIT=(STT.TT),SIGNS=(+,-),LENGTH=6,   
              4,3,PD,EDIT=(STTT.T),SIGNS=(+,-),LENGTH=6)   
OUTFIL IFTHEN=(WHEN=(1,6,CH,EQ,7,6,CH),BUILD=(C'EQ',1,12)),
       IFTHEN=(WHEN=(1,6,CH,GT,7,6,CH),BUILD=(C'GT',1,12)),
       IFTHEN=(WHEN=(1,6,CH,LT,7,6,CH),BUILD=(C'LT',1,12)) 

Is this way better than having this done in COBOL?
Please let me know which is efficient for huge volume of data?

Thanks in advance.
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7226

PostPosted: Wed Nov 05, 2014 4:23 pm    Post subject: Reply to: Compare PD Values with same storage & diff dec
Reply with quote

By "occupy the same storage" do you mean they're the same length, but different number of decimal digits?

You have records that just contain that data?

Have you tested those control cards to see that they get you what you want?

Also.
Back to top
View user's profile Send private message
Shrinika Rajendran

New User


Joined: 06 Jun 2013
Posts: 25
Location: India

PostPosted: Wed Nov 05, 2014 6:00 pm    Post subject: Reply to: Compare PD Values with same storage & diff dec
Reply with quote

Bill,
Yes. Same length data. But different decimal digits.
I get what I want using the control card I have mentioned in my initial post.
I want to know if this is the efficient method of doing this.

Thanks
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7226

PostPosted: Wed Nov 05, 2014 6:59 pm    Post subject: Reply to: Compare PD Values with same storage & diff dec
Reply with quote

I can't see how the comparison would work.

1230 in the first packed field should be the same as 0123 in the second.

Your EDIT will make that +12.30 and +012.3. Those are the same to the human eye, but when you just do a character compare, they are different.

Try with this, which inserts a 0 after the sign for the first EDIT and appends a zero after the second.

Code:
EDIT=(S0TT.TT),SIGNS=(+,-),LENGTH=7,
EDIT=(STTT.T),SIGNS=(+,-),LENGTH=6,C'0')


You should then see:

+012.30 and +012.30, which should compare as equal.

Or I've missed something.

Can you show some sample input and expected output?

As to performance, SORT IO is going to be faster than COBOL. You seem to want the output human-readable, so doing the edit and then compare is not going to be a bad way to do it. The other way involves "scaling" (multiply the one-decimal-place figure by 10) which, since you need the EDIT anyway, is going to be slower.

If you want to see the original style of EDIT for each field after the compare, just extend your BUILD so that it has 1,1,3,5,8,6 and you should get it.

It is easier for humans to read if you include spaces between the things :-)
Back to top
View user's profile Send private message
Shrinika Rajendran

New User


Joined: 06 Jun 2013
Posts: 25
Location: India

PostPosted: Wed Nov 05, 2014 9:17 pm    Post subject: Reply to: Compare PD Values with same storage & diff dec
Reply with quote

I get about CH comparison. I was wrong about it.
Will padding zeros and make the character comparison work for GT and LT conditions?
I am not sure about this.
Code:
+000000400000000.000000000+000000000000500.000000000

In the case above,
Code:
OMIT=(1,26,CH,GE,27,26,CH)

is not working.
What should be the data type when comparing numeric edited fields?
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7226

PostPosted: Wed Nov 05, 2014 9:39 pm    Post subject: Reply to: Compare PD Values with same storage & diff dec
Reply with quote

If the lengths (with padding) and alignment (on decimal point) are the same, there should be no problem with any character comparison you like.

I can't tell what is not working, as you haven't described what "works" would be, nor how that data fails to work. I don't know where you got that data from, and why it is different from the amendments I suggested to your original code, not why you want to OMIT at all, not what you want to do.

So you can see, you need to say in detail what you want, with sample input, expected output and output you are getting, along with control cards and RECFM/LRECL of files.
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
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
No new posts How can we create a flat file in JAVA... rakesh.v18 Java & MQSeries 7 Fri Sep 23, 2016 10:46 pm


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