Packed decimal field in INCLUDE



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

Packed decimal field in INCLUDE

Postby bitbybit » Thu Oct 11, 2012 1:32 am

I have account# defined as 9(15) comp-3, starting at position 51 in my input file. Acct# is always a 14 digit number and I need to split input file into 2 o/p files. One file having all records with last 2 digits of account# equal to 00 and the 2nd having other than 00. How do I write my INCLUDE or OMIT statement in sysin?
Any help is greatly appreciated.
Thnak you.
bitbybit
 
Posts: 29
Joined: Fri Jul 13, 2012 10:05 pm
Has thanked: 6 times
Been thanked: 0 time

Re: Packed decimal field in INCLUDE

 

Re: referencing some bytes of a packed decimal field in INCL

Postby skolusu » Thu Oct 11, 2012 1:50 am

bitbybit,

9(15) comp-3 is an 8 byte PD field. You can use the PD0 format to select the desired records. PD0 ignores the first digit and trailing sign during processing. In your case the X'00' looks for X'h00h' in the last two bytes.(57-58)

Use the following DFSORT JCL which will give you the desired results. I assumed that it your input RECFM=FB . If your input is VB then you need add 4 bytes to the start position as the first 4 bytes has the RDW

//STEP0100 EXEC PGM=SORT                         
//SYSOUT   DD SYSOUT=*                           
//SORTIN   DD DSN=Your Input FB file,DISP=SHR                 
//OUT1     DD SYSOUT=*                           
//OUT2     DD SYSOUT=*                           
//SYSIN    DD *                                 
  SORT FIELDS=COPY                               
  OUTFIL FNAMES=OUT1,INCLUDE=(57,2,PD0,EQ,X'00')
  OUTFIL FNAMES=OUT2,SAVE                       
//*
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

These users thanked the author skolusu for the post:
bitbybit (Thu Oct 11, 2012 2:40 am)
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times

Re: referencing some bytes of a packed decimal field in INCL

Postby bitbybit » Thu Oct 11, 2012 2:17 am

Thank you, that worked.
If I have to sort on the acct#, do I code
SORT FIELDS=(51,8,PD,D)
Or
SORT FIELDS=(51,14,PD,D)
bitbybit
 
Posts: 29
Joined: Fri Jul 13, 2012 10:05 pm
Has thanked: 6 times
Been thanked: 0 time

Re: referencing some bytes of a packed decimal field in INCL

Postby skolusu » Thu Oct 11, 2012 2:29 am

bitbybit wrote:Thank you, that worked.
If I have to sort on the acct#, do I code
SORT FIELDS=(51,8,PD,D)
Or
SORT FIELDS=(51,14,PD,D)



Since your field is defined as 9(15) comp-3 , it will be a 8 byte PD field. You need to code
SORT FIELDS=(51,8,PD,D)
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

These users thanked the author skolusu for the post:
bitbybit (Thu Oct 11, 2012 2:39 am)
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post