Unexpected output using SORT



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

Unexpected output using SORT

Postby porwalrox » Fri Oct 05, 2012 4:24 pm

Hi,
I'm trying to sort a file into two output files using DFSORT but after submitting, It only sorts fields with key2. Both KEY1 & KEY2 files have same data which satisfies the conditions of OUTFIL FNAMES=KEY2OUT but OUTFIL FNAMES=KEY1OUT is not executing.

//U299060A JOB MSGLEVEL=1,CLASS=A,NOTIFY=&SYSUID,REGION=1
//S1 EXEC PGM=SORT                                       
//SYSOUT DD SYSOUT=*                                     
//SORTIN DD DSN=U299060.DFSRTPS.PDS(EXP1INP),DISP=SHR   
//KEY1OUT DD DSN=U299060.DFSRTOUT.PDS(KEY1),DISP=OLD     
//KEY2OUT DD DSN=U299060.DFSRTOUT.PDS(KEY2),DISP=OLD     
//SYSIN DD *                                             
  OPTION COPY                                           
  OUTFIL FNAMES=KEY1OUT,INCLUDE=(3,4,CH,EQ,C'KEY1'),     
  IFTRAIL=(HD=YES,TRLID=(1,1,CH,EQ,C'T'),               
  TRLUPD=(18:COUNT=(M11,LENGTH=8),                       
  33:TOT=(8,4,ZD,M11,LENGTH=6)))                         
  OUTFIL FNAMES=KEY2OUT,INCLUDE=(3,4,CH,EQ,C'KEY2'),     
  IFTRAIL=(HD=YES,TRLID=(1,1,CH,EQ,C'T'),               
  TRLUPD=(18:COUNT=(M11,LENGTH=8),                       
  33:TOT=(8,4,ZD,M11,LENGTH=6)))                         
/*     
My Input file is
H 10/12/2010                         
D KEY1 0100                           
D KEY1 0300                           
D KEY2 0200                           
D KEY2 0050                           
D KEY1 0625                           
D KEY1 0300                           
D KEY2 3000                           
T DEPT AXY COUNT=00000007 TOTAL=004575

& output is same in both files KEY1 & KEY2
H 10/12/2010                         
D KEY2 0200                           
D KEY2 0050                           
D KEY2 3000                           
T DEPT AXY COUNT=00000003 TOTAL=003250


Ridiculous unreadable colour-scheme removed.
porwalrox
 
Posts: 38
Joined: Fri Oct 05, 2012 4:05 pm
Has thanked: 2 times
Been thanked: 0 time

Re: Unexpected output using SORT

Postby BillyBoyo » Fri Oct 05, 2012 4:36 pm

You are outputting simultaneously to two different members on the same, presumably,PDS.

Try outputting to something else (sysout, different flat files) and see.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Unexpected output using SORT

Postby porwalrox » Fri Oct 05, 2012 5:30 pm

Thanks BillyBoyo! But why this is happening? So is it not possible to sort two files within the same PDS? If it is possible, could you please tell me that how can i achieve this?
porwalrox
 
Posts: 38
Joined: Fri Oct 05, 2012 4:05 pm
Has thanked: 2 times
Been thanked: 0 time

Re: Unexpected output using SORT

Postby BillyBoyo » Fri Oct 05, 2012 5:46 pm

It happens because there is an "index" for the PDS, and one updated copy of an index record can get overwritten with another on close.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Unexpected output using SORT

Postby Robert Sample » Fri Oct 05, 2012 5:51 pm

It is not possible to create (or update) two members of a PDS in a single step of a batch job. Meditate on how a PDS works and you will understand why.

You can use SORT to create two members of a PDS, but you have to execute SORT twice to do so.
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: Unexpected output using SORT

Postby porwalrox » Fri Oct 05, 2012 6:14 pm

Got it, Thank you very much Billy & Robert!
porwalrox
 
Posts: 38
Joined: Fri Oct 05, 2012 4:05 pm
Has thanked: 2 times
Been thanked: 0 time

Re: Unexpected output using SORT

Postby skolusu » Fri Oct 05, 2012 8:35 pm

Porwalrox,

You can't use OUTFIL to write to to 2 PDS members in parallel. You can do that with regular sequential data sets or with PDSE members, but NOT with PDS members. So change your JCL to create sequential files or write to a PDSE
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times

Re: Unexpected output using SORT

Postby porwalrox » Sat Oct 06, 2012 2:27 pm

Thanks Skolusu for your very helpful answer!
porwalrox
 
Posts: 38
Joined: Fri Oct 05, 2012 4:05 pm
Has thanked: 2 times
Been thanked: 0 time


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post