Sort using PD key

IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

Sort using PD key

Postby abhi_bhatt2008 » Mon Dec 15, 2008 4:41 pm

Hi all,

I have a file with fields mentioned below:
01 ws-test.
05 ws-test1 pic 9(4) comp-3.
05 ws-test2 pic 9(4) comp-3.
05 ws-test3 pic 9(4) comp-3.
05 ws-test4 pic 9(4) comp-3.

I want to include all those records that matches:
1) first 2 digits of ws-test1 should be '89'
2) first 1 digit of ws-test4 should be '5'

Is it possible?

Please let me know/
Posts: 1
Joined: Mon Dec 15, 2008 4:33 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Sort using PD key


Re: Sort using PD key

Postby Frank Yaeger » Mon Dec 15, 2008 9:35 pm

A pic 9(4) comp-3 value is a 3-byte PD value that looks like this in hex: X'0ddddC'. So based on what you said, for the ws-test1 field you'd want to check for a value like X'089d' in the first two bytes, and for the ws-test4 value, you'd want to check for a value of X'05' in the first byte. Here's a DFSORT job that will do it:

//SORTIN DD DSN=...  input file
//SORTOUT DD DSN=...  output file
//SYSIN    DD    *
  INCLUDE COND=(1,2,PD0,EQ,X'89',AND,10,1,BI,EQ,X'05')
Frank Yaeger - DFSORT Development Team (IBM) -
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at
User avatar
Frank Yaeger
Global moderator
Posts: 1080
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 14 times



  • Related topics
    Last post