IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Selective SORT using SYNCSORT


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Pritam Dass

New User


Joined: 30 Jan 2008
Posts: 6
Location: Noida

PostPosted: Fri Feb 08, 2008 9:47 pm
Reply with quote

HI,

I have a file in which first 5 records are header records ( Not the data only headings). From 6th record I have data which needs to be sorted.
My output file should contain first five records as it is copied from input and rest of the records should be sorted in a given order.
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Fri Feb 08, 2008 10:00 pm
Reply with quote

You need to provide the details such as the RECFM and LRECL of the file, and in your case, what fields you want to sort on and their location and format in the file.
Back to top
View user's profile Send private message
Pritam Dass

New User


Joined: 30 Jan 2008
Posts: 6
Location: Noida

PostPosted: Mon Feb 11, 2008 11:33 pm
Reply with quote

Thanks Kevin,

I am using SYNCSORT. RECFM=FB, LRECL=133.

SORT fields are (1,5,CH,A,30,14,CH,A,65,8,CH,A).

First Five records should not be considered for this SORT, and just copied in the output file. SORT should start from rec number #6 to EOF.

Currently I am doing it in following steps:

1. copy first 5 recs in temp file...F1.
2. SORT the input to output temp file (skiprec=5)...F2
3. Merge the files F1 and F2 using IEBGENER.

I want to do it in a single step if possible.
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1287
Location: Chennai, India

PostPosted: Tue Feb 12, 2008 2:55 am
Reply with quote

Pritamm,

Is there any way to differentiate the header records from the data records? If yes, give us the details.
Back to top
View user's profile Send private message
Pritam Dass

New User


Joined: 30 Jan 2008
Posts: 6
Location: Noida

PostPosted: Thu Feb 14, 2008 12:20 am
Reply with quote

Yes, All data records have date like 20080212 at location 45. Header records do not have date field at location 45.
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 496
Location: USA

PostPosted: Thu Feb 14, 2008 1:18 am
Reply with quote

Quote:
Header records do not have date field at location 45.

In the header records, are there any numerics at position 45?
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 496
Location: USA

PostPosted: Thu Feb 14, 2008 1:35 am
Reply with quote

Pritam Dass wrote:
All data records have date like 20080212 at location 45. Header records do not have date field at location 45.

Assuming all the dates begin with 2, and no header records have a '2' at position 45, try this JCL:
Code:

//SYSIN DD *                                             
   INREC IFTHEN=(WHEN=(45,1,CH,NE,C'2'),OVERLAY=(134:C'1')),
         IFTHEN=(WHEN=(45,1,CH,EQ,C'2'),OVERLAY=(134:C'2')) 
   SORT FIELDS=(134,1,CH,A,1,5,CH,A,30,14,CH,A,65,8,CH,A)
   OUTREC FIELDS=(1,133)                                     
/*         
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 496
Location: USA

PostPosted: Thu Feb 14, 2008 1:39 am
Reply with quote

Depending on what your header records have in the sort control fields, they may get re-ordered in my previous job. If this is the case, let me know and I'll modify the job for you.
Back to top
View user's profile Send private message
Amit Banerjee

New User


Joined: 12 Jan 2008
Posts: 14
Location: india

PostPosted: Thu Feb 14, 2008 4:01 am
Reply with quote

Hi.I think you can use this if u're sure that the first five records are headers
sort card -
SORT FIELDS=(1,5,CH,A,30,14,CH,A,65,8,CH,A)
STARTREC=6
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Thu Feb 14, 2008 4:07 pm
Reply with quote

Try this untested SORT JCL,
Code:
//*******************************************************         
//STEP1    EXEC PGM=SORT                                         
//SYSOUT   DD SYSOUT=*                                           
//SORTIN   DD I/P FILE (133/FB)                                   
//SORTOUT  DD O/P FILE(133/FB)                                   
//SYSIN    DD *                                                   
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(134:SEQNUM,8,ZD)),             
        IFTHEN=(WHEN=(134,8,ZD,GE,+6),OVERLAY=(134:8C'9'))       
  SORT FIELDS=(134,8,CH,A,1,5,CH,A,30,14,CH,A,65,8,CH,A)
  OUTREC FIELDS=(1,133)                                           
/*                                                               
Back to top
View user's profile Send private message
Pritam Dass

New User


Joined: 30 Jan 2008
Posts: 6
Location: Noida

PostPosted: Sun Mar 09, 2008 6:29 pm
Reply with quote

Thanks for your response. I used the soultion mentioned by krisprems and it worked icon_smile.gif .
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
Search our Forums:

Back to Top