IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Extract records from a file based on a negative value


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Jan 29, 2014 1:44 am
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Jan 29, 2014 1:47 am
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
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
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Jan 29, 2014 2:12 am
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 1
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top