View previous topic :: View next topic
|
Author |
Message |
suraaj
New User
Joined: 16 Apr 2009 Posts: 69 Location: Canada
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
the image of the data You posted is just rubbish
use HEX ON and show the hexadecimal representation |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
suraaj
New User
Joined: 16 Apr 2009 Posts: 69 Location: Canada
|
|
|
|
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 |
|
|
suraaj
New User
Joined: 16 Apr 2009 Posts: 69 Location: Canada
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
suraaj
New User
Joined: 16 Apr 2009 Posts: 69 Location: Canada
|
|
|
|
Thanks Bill...
Apologize for the confusion... |
|
Back to top |
|
|
|