Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Selective SORT using SYNCSORT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Selective SORT using SYNCSORT
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

Moderator Team Head


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

PostPosted: Fri Feb 08, 2008 10:00 pm    Post subject: Reply to: Selective SORT
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    Post subject: Select Sort
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: 1288
Location: Chennai, India

PostPosted: Tue Feb 12, 2008 2:55 am    Post subject: Reply to: Selective SORT using SYNCSORT
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    Post subject: Selective Sort
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: 500
Location: USA

PostPosted: Thu Feb 14, 2008 1:18 am    Post subject:
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: 500
Location: USA

PostPosted: Thu Feb 14, 2008 1:35 am    Post subject: Re: Selective Sort
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: 500
Location: USA

PostPosted: Thu Feb 14, 2008 1:39 am    Post subject:
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    Post subject:
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    Post subject:
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    Post subject: Reply to: Selective SORT using SYNCSORT
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to change 'K' or 'M' use Sort vice_versa DFSORT/ICETOOL 5 Thu May 18, 2017 7:11 am
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
This topic is locked: you cannot edit posts or make replies. SORT trick needed bshkris SYNCSORT 6 Tue May 02, 2017 4:35 am
No new posts SORT JSON type of data maxsubrat DFSORT/ICETOOL 8 Wed Apr 19, 2017 6:01 pm
No new posts Sort Large record length cmsmoon DFSORT/ICETOOL 14 Tue Apr 11, 2017 5:49 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us