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
 

 

Include condition for for checking a numeric value in rec

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

New User


Joined: 24 Aug 2007
Posts: 24
Location: bangalore

PostPosted: Tue Sep 11, 2007 5:42 pm    Post subject: Include condition for for checking a numeric value in rec
Reply with quote

Hi ,
I have a input file of the below mentioned format.

MasterCard 5100 natwest
MasterCard 5101 hsbc
MasterCard 5101 natwest
MasterCard 5102 natwest
MasterCard 5102 natwest
Visa 400844 natwest
Visa 400880 natwest
Visa 401317 natwest
Visa 401343 natwest
Visa 401344 natwest
Visa 401744 natwest
UK Maestro 676795
UK Maestro 676796
UK Maestro 676798
UK Maestro 676799
UK Maestro 677230


My requirement is to copy all the records which has numeric value in the 6th column. here only Visa cards have numeric values in 6th posistion.

I have used the below mentioned condition

//sysin dd *
sort fields=(1,4,ch,a)
include cond=(6,1,zd,ge,0,and,6,1,zd,le,9)
/*


i have also tried with
//sysin dd *
sort fields=copy
include condition=(1,4,ch,eq,c'Visa')
/*

but still in the output i am getting other records which dont have numeric values in the 6th column or does not have a character visa in the begining.
Back to top
View user's profile Send private message

saiprasadh

Active User


Joined: 20 Sep 2006
Posts: 154
Location: US

PostPosted: Tue Sep 11, 2007 5:50 pm    Post subject:
Reply with quote

Hi Raghavendra,

Try this sort card

Code:

  INCLUDE=(6,1,FS,EQ,NUM)         


Thanks
Sai
Back to top
View user's profile Send private message
William Thompson

Global Moderator


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

PostPosted: Tue Sep 11, 2007 5:54 pm    Post subject: Re: Include condition for for checking a numeric value in re
Reply with quote

Raghavendra P K wrote:
but still in the output i am getting other records which dont have numeric values in the 6th column or does not have a character visa in the begining.
I find that very hard to believe, what proof can you provide (the sort's sysouts?) that shows that you are using that include and sort is ignoring it?
Back to top
View user's profile Send private message
Raghavendra P K

New User


Joined: 24 Aug 2007
Posts: 24
Location: bangalore

PostPosted: Tue Sep 11, 2007 7:00 pm    Post subject:
Reply with quote

Thanks Sai,

its working now.
Back to top
View user's profile Send private message
Raghavendra P K

New User


Joined: 24 Aug 2007
Posts: 24
Location: bangalore

PostPosted: Tue Sep 11, 2007 7:13 pm    Post subject:
Reply with quote

Hi Sai,

I have one more doubt , what is that FS stands for. In what situations we need to use it.
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: Tue Sep 11, 2007 9:15 pm    Post subject:
Reply with quote

Quote:
but still in the output i am getting other records which dont have numeric values in the 6th column


I can explain that. You have 6,1,ZD in your condition. A 1-byte ZD value has is sd where s is the sign and d is the digit. In your Mastercard records, position 6 has 'r' = X'99' which is actually a ZD value of -9 (a sign of 9 is treated as negative). Since -9 is less than +0, these records are not included. But in your UK Maestro records, position 6 has 'e' = X'85' which is actually a ZD value of +5 (a sign of 8 is treated as positive). Since +5 is gt +0 and lt +9, these records are included.

If you had used CH instead of ZD, your INCLUDE statement would have worked:

Code:

   INCLUDE COND=(6,1,CH,GE,C'0',AND,6,1,CH,LE,C'9') 


But a better way is to use DFSORT's NUM function:

Code:

  INCLUDE COND=(6,1,FS,EQ,NUM)     


FS is used here for a character numeric value of '0'-'9'. For more information on DFSORT's NUM function, see:

www.ibm.com/servers/storage/support/software/sort/mvs/peug/
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Tue Sep 11, 2007 9:22 pm    Post subject:
Reply with quote

Frank Yaeger wrote:
If you had used CH instead of ZD, your INCLUDE statement would have worked:
Why?
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: Tue Sep 11, 2007 10:08 pm    Post subject:
Reply with quote

Because with CH, C'0' and C'9', you would be looking for values between '0'-'9' = X'F0'-X'F9', so nothing outside of those values would be included, e.g. 'r' = X'99' is lt X'F0' and 'e' = X'85' is lt X'F0'.

Note that FS,EQ,NUM looks for values between '0'-'9' as well.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Tue Sep 11, 2007 10:33 pm    Post subject:
Reply with quote

Thanks, I'm seeing that in the ZD compare, the sign half byte messes things up, right?
I am not quite sure what you mean by:
Quote:
e.g. 'r' = X'99' is lt X'F0' and 'e' = X'85' is lt X'F0'.
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: Tue Sep 11, 2007 11:34 pm    Post subject:
Reply with quote

Yes, if you use ZD it treats the value as signed and messes things up (see my previous post).

If you use CH or BI, it treats the value as unsigned so

Code:

   INCLUDE COND=(6,1,CH,GE,C'0',AND,6,1,CH,LE,C'9') 


is equivalent to checking for an unsigned binary value between X'F0' and X'F9'. In the example input, 'r', 4' and 'e' are the values in position 6. 'r' is X'99' in hex and 'e' is X'85' in hex - both are treated as less than X'F0' when you use CH or BI. '4' is X'F4' in hex and is treated as between X'F0' and X'F9' when you use CH, BI or ZD.

Does that help?
Back to top
View user's profile Send private message
Raghavendra P K

New User


Joined: 24 Aug 2007
Posts: 24
Location: bangalore

PostPosted: Thu Sep 13, 2007 1:02 pm    Post subject:
Reply with quote

Hi Frank,

thanks a lot for your valuable suggestions.
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Fri Sep 14, 2007 1:11 pm    Post subject:
Reply with quote

Quite a valuable information is there in this thread about 'CH' & 'ZD' icon_smile.gif . Marked for my future reference icon_smile.gif
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 Validate if a Value from the file is ... balacsv2 COBOL Programming 8 Mon Jun 19, 2017 11:52 pm
No new posts Include/omit with "ALL" pa... mgl DFSORT/ICETOOL 6 Wed Jun 14, 2017 2:31 pm
No new posts NDM syntax checking without actually ... GAPX1 All Other Mainframe Topics 0 Wed Jun 07, 2017 2:36 am
This topic is locked: you cannot edit posts or make replies. Need help on If condition continuatio... ashok_uddaraju CLIST & REXX 4 Fri May 19, 2017 8:55 am
No new posts Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm


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