how to copy header record during sorting.

Support for NetApp SyncSort for z/OS, Visual SyncSort, SYNCINIT, SYNCLIST and SYNCTOOL
helen2000
Posts: 85
Joined: Sat Aug 08, 2009 9:44 pm
Skillset: cobol,jcl,fileaid
Referer: internet

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.

nayanpatra
Posts: 19
Joined: Mon Jul 06, 2009 4:35 pm
Skillset: JCL, COBOL, VSAM, DB2, SUPRA, CICS
Referer: Browsing

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.

User avatar
arcvns
Posts: 55
Joined: Sat Feb 28, 2009 12:36 am
Skillset: COBOL, JCL, SYNCSORT, VSAM, DB2
Referer: Nobody
Location: India
Contact:

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.

Code: Select all

//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

Code: Select all

HEADER
KEY-A
KEY-B
KEY-C
KEY-D
Arun

ranga_subham
Posts: 279
Joined: Fri Jul 18, 2008 7:46 pm
Skillset: JCL,COBOL,DB2,IMS/DB,CICS,VSAM
Referer: I was banned by superk in main forum so I am here

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.

helen2000
Posts: 85
Joined: Sat Aug 08, 2009 9:44 pm
Skillset: cobol,jcl,fileaid
Referer: internet

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.

Code: Select all

 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 /*           

User avatar
dick scherrer
Global moderator
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am

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.

helen2000
Posts: 85
Joined: Sat Aug 08, 2009 9:44 pm
Skillset: cobol,jcl,fileaid
Referer: internet

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.

Alissa Margulies
Global moderator
Posts: 369
Joined: Tue Feb 26, 2008 11:15 pm
Skillset: Syncsort MFX for z/OS
Referer: Dick Scherrer
Location: USA
Contact:

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

User avatar
arcvns
Posts: 55
Joined: Sat Feb 28, 2009 12:36 am
Skillset: COBOL, JCL, SYNCSORT, VSAM, DB2
Referer: Nobody
Location: India
Contact:

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

nayanpatra
Posts: 19
Joined: Mon Jul 06, 2009 4:35 pm
Skillset: JCL, COBOL, VSAM, DB2, SUPRA, CICS
Referer: Browsing

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.


  • Similar Topics
    Replies
    Views
    Last post