put sort key in the end of input record during sorting



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

put sort key in the end of input record during sorting

Postby helen2000 » Wed Feb 03, 2010 5:47 am

Hi All,

I first put one sort key in the end of the input record using INREC, and then
sorting, I got the error message:"control fields beyond record"
my input file: VB, LRECL=2000

this is my jcl:
//SORTSTEP EXEC PGM=ICETOOL
//TOOLMSG  DD SYSOUT=*
//DFSMSG   DD SYSOUT=*
//IN DD DSN=MP.IMP0CMO9(0), DISP=SHR
//OUT DD DSN=MP.SORT.DATA,
//       DISP=(NEW,CATLG,CATLG),
//       UNIT SYSDA,
//       SPACE=(TRK,(20,50),RLSE)
//TOOLIN DD *
DATASORT FROM(IN) TO(OUT) HEADER TRAILER USING(CTL1)
/*
//CTL1CNTL DD *
  INREC IFTHEN=(WHEN=(13,2,BI,EQ,X'3068'),
                BUILD=(1,2004,X'00000000')),
        IFTHEN==(WHEN=(13,2,BI,EQ,X'3069'),
                 OVERLAY=(2005:537,4,BI)),
        IFTHEN==(WHEN=(13,2,BI,EQ,X'306A'),
                 OVERLAY=(2005:537,4,BI))
  SORT FIELDS=(91,10,CH,A,
               2005,4,BI,A,
               616,10,CH,A,
               614,2,BI,A)
/*
//*
I know the reason is 2005 > 2000+4, but I have to put the key to the end of the input record, anybody can
help me? thanks,
helen
helen2000
 
Posts: 85
Joined: Sat Aug 08, 2009 9:44 pm
Has thanked: 0 time
Been thanked: 0 time

Re: put sort key in the end of input record during sorting

Postby skolusu » Wed Feb 03, 2010 11:35 pm

helen2000,

I am not sure those are even valid control cards. By adding an additional fields at the end of of a VB file you are actually nullifying the concept of having VB file in the first place. For VB files you can add the constants right after the RDW and then remove them while writing out. Use the following

//SORTSTEP EXEC PGM=ICETOOL                             
//TOOLMSG  DD SYSOUT=*                                 
//DFSMSG   DD SYSOUT=*                                 
//IN       DD DSN=MP.IMP0CMO9(0),DISP=SHR               
//OUT      DD DSN=MP.SORT.DATA,                         
//            DISP=(NEW,CATLG,CATLG),                   
//            UNIT=SYSDA,                               
//            SPACE=(TRK,(20,50),RLSE)                 
//TOOLIN   DD *                                           
DATASORT FROM(IN) TO(OUT) HEADER TRAILER USING(CTL1)   
//*                                                     
//CTL1CNTL DD *
  OPTION VLSHRT                                       
  INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,4X,5)),           
        IFTHEN=(WHEN=(17,2,BI,EQ,X'3068'),             
             OVERLAY=(5:X'00000000')),                 
        IFTHEN=(WHEN=(17,2,BI,EQ,X'3069'),             
             OVERLAY=(5:541,4)),                       
        IFTHEN=(WHEN=(17,2,BI,EQ,X'306A'),             
             OVERLAY=(5:541,4))                         
                                                       
  SORT FIELDS=(095,10,CH,A,                             
               005,04,BI,A,                             
               620,10,CH,A,                             
               618,02,BI,A)                             
                                                       
  OUTFIL FNAMES=OUT,BUILD=(1,4,9)                       
//*                                                     
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: put sort key in the end of input record during sorting

Postby helen2000 » Thu Feb 04, 2010 3:48 am

thank you very much, Skolusu, I will try your idea today.
just now I use another idea and sorting is well. the jcl is as following:
  INREC IFTHEN=(WHEN=(13,2,BI,EQ,X'3068'),                   
                OVERLAY=(2005:537,4,BI,537:X'00000000'))     
  SORT FIELDS=(91,10,CH,A,                                   
               537,4,BI,A,                                   
               616,10,CH,A,                                   
               614,2,BI,A)                                   
  OUTREC IFTHEN=(WHEN=(13,2,BI,EQ,X'3068'),                   
                 OVERLAY=(537:2005,4,BI))                     


but I have a little bit confuse, the data in offset 537 is totally different between In and out record. the logical is I first put the data in offset 537 to offset 2005 before sorting,and then, I put back the data in offset 2005 to offset 537 after sorting. when I comment out the OUTREC in JCL, I can see the data
in offset 2005 is the same with the data in offset 537. why it will change after sorting.
could you give me a correct answer? thank you very much!
helen2000
 
Posts: 85
Joined: Sat Aug 08, 2009 9:44 pm
Has thanked: 0 time
Been thanked: 0 time

Re: put sort key in the end of input record during sorting

Postby skolusu » Thu Feb 04, 2010 10:56 pm

but I have a little bit confuse, the data in offset 537 is totally different between In and out record. the logical is I first put the data in offset 537 to offset 2005 before sorting,and then, I put back the data in offset 2005 to offset 537 after sorting. when I comment out the OUTREC in JCL, I can see the data in offset 2005 is the same with the data in offset 537. why it will change after sorting.


Helen,

when you 537,4,BI it is treated as an edited numeric input field to appear in the reformatted OUTFIL output record. So BI field is actually expanded to readable format. If you want to retain the original value , just code 537,4. You don't need to specify the format.

And as I mentioned earlier , remember that adding the fields at the end is a bad idea for VB files
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: put sort key in the end of input record during sorting

Postby helen2000 » Fri Feb 05, 2010 7:53 am

thanks for your help, Mr. Skolusu. It works very well using your code.
would you mind answer one more question for me?
I need shorten the length of out record to 1800, how to do that?
thanks again,Helen
helen2000
 
Posts: 85
Joined: Sat Aug 08, 2009 9:44 pm
Has thanked: 0 time
Been thanked: 0 time

Re: put sort key in the end of input record during sorting

Postby Frank Yaeger » Sat Feb 06, 2010 12:45 am

I need shorten the length of out record to 1800, how to do that?


It's not clear what you want to do. Do you want all of the VB records to be 1800 bytes long (not the best use of a VB file)? Or do you want the maximum LRECL of the output file to be 1800 with the records up to 1800 bytes long? Or do you want something else (what exactly)?

I don't really see how the length of 1800 relates to Kolusu's job.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 15 times

Re: put sort key in the end of input record during sorting

Postby helen2000 » Sun Feb 07, 2010 3:37 am

Hi, Frank, I want the maximum LRECL of the output file to be 1800, as well as I will cut the size which beyond 1800 for the output record. can I code like the following for the above skolusu's jcl:

OUTFIL FNAMES=OUT,BUILD=(1,4,9:9,1800)

thanks,

Helen
helen2000
 
Posts: 85
Joined: Sat Aug 08, 2009 9:44 pm
Has thanked: 0 time
Been thanked: 0 time

Re: put sort key in the end of input record during sorting

Postby skolusu » Mon Feb 08, 2010 11:01 pm

helen,

If all of the records in the input file have a length of 1800 then you are fine , but if you have short records then you will encounter ICE218A error. Also an 1800 LRECL for a VB file means that the actual data record is only 1796 bytes. So change your OUTFIL statement as follows

   OUTFIL FNAMES=OUT,BUILD=(1,4,9,1796)
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