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 a COMP-3 Value in a sort

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
shreevamsi

Active User


Joined: 23 Feb 2006
Posts: 305
Location: Hyderabad,India

PostPosted: Fri May 25, 2007 5:07 pm    Post subject: Compare a COMP-3 Value in a sort
Reply with quote

HI,

I was struck up while comparing a comp-3 value from the input file and based on that value, i should write it in one of the output file.
I have a comp-3 value @ 19th position of declaretion S9(9)v99.
Now i need to check the value. If the value is less that 1000,000, i should be writing to one output file. Else into another.
could anybody help me with the sort card??

~Vamsi
Back to top
View user's profile Send private message

Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Sun May 27, 2007 12:42 am    Post subject:
Reply with quote

S9(9)v99 COMP-3 is a 6-byte PD value with two decimal places (implied). Externally an example of the value might be +123456789.01 or -123456789.01. You say you want to compare it to 1000,000. It's not clear exactly what constant you mean by that. Do you mean +001000000.00 or something else?
Back to top
View user's profile Send private message
shreevamsi

Active User


Joined: 23 Feb 2006
Posts: 305
Location: Hyderabad,India

PostPosted: Mon May 28, 2007 6:06 pm    Post subject: Re: Compare a COMP-3 Value in a sort
Reply with quote

Hi Frank,
I am expecting a positive value. +001000000.00.

But what if the value is a negative which is less than -10000.

Can't we compare the value including the sign?
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Mon May 28, 2007 9:59 pm    Post subject:
Reply with quote

Quote:
If the value is less that 1000,000, i should be writing to one output file. Else into another


Here's a DFSORT job to do that:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file
//OUT1 DD DSN=...  output file1 (< +001000000.00)
//OUT2 DD DSN=...  output file2 (>= +001000000.00)
//SYSIN    DD    *
  OPTION COPY
  OUTFIL FNAMES=OUT1,INCLUDE=(19,6,PD,LT,+00100000000)
  OUTFIL FNAMES=OUT2,SAVE
/*


Quote:
But what if the value is a negative which is less than -10000.

Can't we compare the value including the sign?


PD values are signed. You can use a negative constant in the INCLUDE statement (-n).

If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

www.ibm.com/servers/storage/support/software/sort/mvs/srtmpub.html
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Storing huge volume of data, compare ... Pradeep K M All Other Mainframe Topics 3 Mon Jan 16, 2017 5:08 pm
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 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
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 Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm


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