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
 

 

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

Global Moderator


Joined: 14 Mar 2007
Posts: 10232
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: 7308

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: 7308

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 Changing of LRECL of a file abdulrafi DFSORT/ICETOOL 2 Fri Mar 24, 2017 3:25 pm
No new posts splitting a file abdulrafi DFSORT/ICETOOL 4 Fri Mar 24, 2017 11:51 am
No new posts Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm
No new posts Formatting VB File Learncoholic DFSORT/ICETOOL 3 Mon Mar 20, 2017 12:29 pm


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