Sort Depending on Field Length



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

Sort Depending on Field Length

Postby vegafacundodaniel » Tue Jul 20, 2010 4:41 pm

I have an input VARIABLE dataset. Something like this :
-TEST1
-123456
-ABCDEF
-BFDSS

My field starts at the 1st position of the file and it takes 6 positions. X(6)

I must sort all records with :
- For the records with 6 characters in the field, I have to take the last 5 characters. For ex: For ABCDEF, I need to take BCDEF.
- For the records with 5 characters in the field, I have to take the 5 characters. For ex: For TEST1, I need to take TEST1

The sorted output file must be:
-BCDEF
-BFDSS
-TEST1
-23456

It is important to consider that the input file is variable.
vegafacundodaniel
 
Posts: 61
Joined: Tue Jul 20, 2010 4:27 pm
Has thanked: 1 time
Been thanked: 0 time

Re: Sort Depending on Field Length

 

Re: Sort Depending on Field Length

Postby skolusu » Tue Jul 20, 2010 9:24 pm

vegafacundodaniel wrote:It is important to consider that the input file is variable.


vegafacundodaniel,


Did you mean to say that the input file is DCB is VB which has the RDW in the first 4 bytes? or the file is FB file but the DATA in the file is variable?

Since you did not provide the LRECL and RECFM , for now I am going to assume it is FB recfm and LRECL of 80.


The following DFSORT JCL will give you the desired results

//STEP0100 EXEC PGM=SORT                       
//SYSOUT   DD SYSOUT=*                         
//SORTIN   DD *                               
-TEST1                                         
-123456                                       
-ABCDEF                                       
-BFDSS                                         
//SORTOUT  DD SYSOUT=*                         
//SYSIN    DD *                               
  INREC OVERLAY=(81:2,6,JFY=(SHIFT=RIGHT))     
  SORT FIELDS=(82,5,CH,A)                     
  OUTREC BUILD=(1,1,82,5,X,8,73)               
//*


The output of this is

-BCDEF
-BFDSS
-TEST1
-23456
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: Sort Depending on Field Length

Postby vegafacundodaniel » Wed Jul 21, 2010 4:36 pm

Thanks Skolusu for your help,

My input file is VB of 1000 characters (which has the RDW in the first 4 bytes) and my output file is FB 996.

Thanks in advance !!!
vegafacundodaniel
 
Posts: 61
Joined: Tue Jul 20, 2010 4:27 pm
Has thanked: 1 time
Been thanked: 0 time

Re: Sort Depending on Field Length

Postby skolusu » Wed Jul 21, 2010 11:20 pm

vegafacundodaniel wrote:Thanks Skolusu for your help,

My input file is VB of 1000 characters (which has the RDW in the first 4 bytes) and my output file is FB 996.

Thanks in advance !!!



*Sigh* You show an example of 6 characters out of which you removed just 1 character . But now you show that need 4 bytes to be taken off from the input. What is the position and format of the input field that you want to sort and what are the complete rules?

Here is a sample job which assumes that your sorting start starts at pos 6 for 6 bytes and you want to remove the first byte of it. The output file is VB with LRECL of 999

//STEP0100 EXEC PGM=SORT                     
//SYSOUT   DD SYSOUT=*                       
//SORTIN   DD DSN=Your input VB 1000 byte file,DISP=SHR               
//SORTOUT  DD SYSOUT=*                       
//SYSIN    DD *                               
  INREC BUILD=(1,4,6,6,JFY=(SHIFT=RIGHT),5)   
  SORT FIELDS=(6,5,CH,A),EQUALS                     
  OUTREC BUILD=(1,4,11,1,6,5,18)             
//*
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: Sort Depending on Field Length

Postby NicC » Thu Jul 22, 2010 1:08 am

errr...Kolusu - he wants a RECFM=FB LRECL=996 output file
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2690
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisys (almost)
Has thanked: 4 times
Been thanked: 105 times

Re: Sort Depending on Field Length

Postby skolusu » Thu Jul 22, 2010 2:01 am

NicC wrote:errr...Kolusu - he wants a RECFM=FB LRECL=996 output file


oops . just noticed that. Thanks, In that case he needs to use the following control cards.
//SYSIN    DD *                                   
  INREC BUILD=(1,4,6,6,JFY=(SHIFT=RIGHT),5)       
  SORT FIELDS=(6,5,CH,A)                         
  OUTFIL VTOF,BUILD=(11,996)                     
//*
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


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post