Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Extract records from a file based on a negative value

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

New User


Joined: 16 Apr 2009
Posts: 69
Location: Canada

PostPosted: Wed Jan 29, 2014 1:14 am    Post subject: Extract records from a file based on a negative value
Reply with quote

Hi

I have a file which has decimal values in the format S9(15)v9(2) at position 1. I have to check if this value is lesser than (-20000). If it is lesser then write it to another file. Please find below sample code

INPUT
Code:


.....ícb).
..........
..........
..........
..........
..........
..........
..........
..........
..........
.....íÉå..
.....íÉå..
.....íÉå..
.....íÉå..


SORT
Code:

SORT    FIELDS=COPY
INCLUDE COND=(84,17,PD,LT,-20000)


This is giving me an empty file as result although I know that there are records which satisfy the condition. Kindly help.

Regards Suraaj
Back to top
View user's profile Send private message

enrico-sorichetti

Senior Member


Joined: 14 Mar 2007
Posts: 10493
Location: italy

PostPosted: Wed Jan 29, 2014 1:44 am    Post subject: Reply to: Extract records from a file based on a negative va
Reply with quote

the image of the data You posted is just rubbish icon_evil.gif

use HEX ON and show the hexadecimal representation
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7314

PostPosted: Wed Jan 29, 2014 1:47 am    Post subject: Reply to: Extract records from a file based on a negative va
Reply with quote

In your include you are saying that your PD is 17 bytes long. In your example, you show nine bytes.

"At position 1" isn't the same as 84, but I don't know which is correct.
Back to top
View user's profile Send private message
suraaj

New User


Joined: 16 Apr 2009
Posts: 69
Location: Canada

PostPosted: Wed Jan 29, 2014 1:53 am    Post subject:
Reply with quote

Code:
..........
0000000000
00000000C0
----------
..........
0000000000
00000000C0
----------
.....íÉå..
0000057400
00000517D0
----------
.....íÉå..
0000057400
00000517D0
----------
.....íÉå..
0000057400
00000517D0
----------
.....íÉå..
0000057400
00000517D0
----------
..........
0000001010
00000131D0
----------
..........
0000001010
00000131D0
----------


SORT:
Code:
SORT    FIELDS=COPY
INCLUDE COND=(1,17,PD,LT,-20000)


The nine bytes is PD and 17 bytes is the unpacked length.

Regards Suraaj
Back to top
View user's profile Send private message
suraaj

New User


Joined: 16 Apr 2009
Posts: 69
Location: Canada

PostPosted: Wed Jan 29, 2014 2:05 am    Post subject: Reply to: Extract records from a file based on a negative va
Reply with quote

I think the solution is :

Code:
SORT    FIELDS=COPY
INCLUDE COND=(84,9,PD,LT,-2000000)


the 2000000 includes the last two decimals as well. Correct me if I am wrong.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7314

PostPosted: Wed Jan 29, 2014 2:12 am    Post subject: Reply to: Extract records from a file based on a negative va
Reply with quote

There are no decimal places in SORT, you have to code for them. If you have an integer value, you will have to include 00 at the right of the number, yes.

The hex display you should is showing 10 bytes, the first nine of which look like packed-decimal values which, whatever you may think, is the length of your field,

1,17,PD is 35 digits. 1,9,PD is 17 digits. You may believe this or not, it is certainly your choice, but only a length of nine stands a chance of working, unless your field happens to be preceded by a bunch of binary zeros, which it can't be if it starts at position one, but can be if you happen to have got the 84 wrong in a co-incidental way.

Edit: Fixed error induced whilst typing with my back to the screen.
Back to top
View user's profile Send private message
suraaj

New User


Joined: 16 Apr 2009
Posts: 69
Location: Canada

PostPosted: Wed Jan 29, 2014 2:15 am    Post subject:
Reply with quote

Thanks Bill...

icon_sad.gif Apologize for the confusion...
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 Concatenaing multiple rows to single ... Vignesh Sid DFSORT/ICETOOL 1 Tue Aug 14, 2018 8:59 am
No new posts Join 2 File using a Join Key scorp_rahul23 DFSORT/ICETOOL 6 Tue Aug 14, 2018 7:36 am
No new posts JCL to send email along with formated... wik123 JCL & VSAM 5 Thu Aug 09, 2018 9:48 am
No new posts How can we create a flat file in JAVA... jasorn Java & MQSeries 2 Wed Aug 08, 2018 3:08 pm
No new posts Need Help on sending email by includi... wik123 JCL & VSAM 9 Mon Jul 30, 2018 2:59 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us