how to copy header record during sorting.



Support for NetApp SyncSort for z/OS, Visual SyncSort, SYNCINIT, SYNCLIST and SYNCTOOL

how to copy header record during sorting.

Postby helen2000 » Tue Aug 11, 2009 9:53 am

Hi All,

I have a trouble during sorting. I can sort all records except the header. because my header record didn't have
sort key. does anybody have good idea for that first copy the header record and then sorting the others records.
my sort production is Syncsort for Z/os.

thanks.
helen2000
 
Posts: 80
Joined: Sat Aug 08, 2009 9:44 pm
Has thanked: 0 time
Been thanked: 0 time

Re: how to copy header record during sorting.

 

Re: how to copy header record during sorting.

Postby nayanpatra » Tue Aug 11, 2009 12:30 pm

STEP010: First break the file into two files using STOPAFT = 1 for the header and SKIPREC = 1 to capture the records without header. Remember to use SORT FIELDS = COPY.
STEP020: Now sort the second file containing only the records acc. to your requirements.
STEP030: Next combine the two files into a single file. For this you can use REPRO and give the two files as the SORTIN DD statement. In the control card use SORT FIELDS = COPY.
nayanpatra
 
Posts: 19
Joined: Mon Jul 06, 2009 4:35 pm
Has thanked: 0 time
Been thanked: 0 time

Re: how to copy header record during sorting.

Postby arcvns » Tue Aug 11, 2009 6:32 pm

Hello,

Here's a one-step SyncSort job which does exactly what you asked. This is just a sample, you can easily modify it as per your requirement.
Let me know if you come across any issues.
//STEP1  EXEC PGM=SORT                                   
//SYSOUT   DD SYSOUT=*                                   
//SORTIN   DD *                                         
HEADER                                                   
KEY-A                                                   
KEY-C                                                   
KEY-D                                                   
KEY-B                                                   
//SORTOUT  DD SYSOUT=*                                   
//SYSIN    DD *                                         
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD,C'1')),
        IFTHEN=(WHEN=(81,8,ZD,EQ,1),OVERLAY=(89:C'0'))   
  SORT FIELDS=(89,1,CH,A,1,5,CH,A)                       
  OUTFIL BUILD=(1,80)   
SORTOUT
HEADER
KEY-A
KEY-B
KEY-C
KEY-D
Arun
User avatar
arcvns
 
Posts: 55
Joined: Sat Feb 28, 2009 12:36 am
Location: India
Has thanked: 0 time
Been thanked: 0 time

Re: how to copy header record during sorting.

Postby ranga_subham » Tue Aug 11, 2009 9:18 pm

Arun, what a cool trick this is....... :) Very nice.
ranga_subham
 
Posts: 279
Joined: Fri Jul 18, 2008 7:46 pm
Has thanked: 0 time
Been thanked: 1 time

Re: how to copy header record during sorting.

Postby helen2000 » Tue Aug 11, 2009 11:49 pm

thanks all of you.
it works well right now. but there is
a little bit problem. my input record is VB. althougn I
got the output dataset. but the header record is
extended to 2004. Could you tell me how to keep the same
size as before sorting for the header record. thanks.
 026900 //SYSIN    DD  *                               
 026910   INREC IFTHEN=(WHEN=(6,5,ZD,EQ,12251),       
 026920                 OVERLAY=(249:C'0',2004:C'0')) 
 027000   SORT FIELDS=(40,10,CH,A,                     
 027100                11,8,CH,A,                     
 027200                249,2,BI,A)                     
 027210 //*            SKIPREC=1                       
 027300 /*           
helen2000
 
Posts: 80
Joined: Sat Aug 08, 2009 9:44 pm
Has thanked: 0 time
Been thanked: 0 time

Re: how to copy header record during sorting.

Postby dick scherrer » Wed Aug 12, 2009 12:30 am

Hello,

You might consider placing the seqnum at the beginning of the records instead of the end. . .
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: how to copy header record during sorting.

Postby helen2000 » Wed Aug 12, 2009 1:30 am

thanks, dick

maybe I didn't describe the problem clear. the input dataset have 3 sort key(offset is 40,11 and 249).
all input record have the 3 sort key except header(just 2 sort key, because header's size is 166).
when I run the JCL, got the error message:" control field exceed size". that's why I have to extend
the header record size before sorting.
helen2000
 
Posts: 80
Joined: Sat Aug 08, 2009 9:44 pm
Has thanked: 0 time
Been thanked: 0 time

Re: how to copy header record during sorting.

Postby Alissa Margulies » Wed Aug 12, 2009 1:32 am

Helen2000,

Do you want the header record to remain as the first record, or to be sorted along with all the data records?
Alissa Margulies
Syncsort Mainframe Product Services
201-930-8260
zos_tech@syncsort.com
Alissa Margulies
Global moderator
 
Posts: 369
Joined: Tue Feb 26, 2008 11:15 pm
Location: USA
Has thanked: 1 time
Been thanked: 1 time

Re: how to copy header record during sorting.

Postby arcvns » Wed Aug 12, 2009 10:05 am

helen2000,

A few more questions apart from what Alissa has asked.

Does "(6,5,ZD,EQ,12251)" identify your header record?
What is your input LRECL?
Arun
User avatar
arcvns
 
Posts: 55
Joined: Sat Feb 28, 2009 12:36 am
Location: India
Has thanked: 0 time
Been thanked: 0 time

Re: how to copy header record during sorting.

Postby nayanpatra » Thu Aug 13, 2009 10:16 am

You could convert from variable format to fixed format.
nayanpatra
 
Posts: 19
Joined: Mon Jul 06, 2009 4:35 pm
Has thanked: 0 time
Been thanked: 0 time

Next

Return to Syncsort/Synctool

 


  • Related topics
    Replies
    Views
    Last post