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

Omit Last Record in Sort


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
shrivatsa
Warnings : 1

Active User


Joined: 17 Mar 2006
Posts: 174
Location: Bangalore

PostPosted: Mon Oct 01, 2007 12:47 pm
Reply with quote

Anyone know how to omit the last record in SYNCSORT?
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Mon Oct 01, 2007 1:07 pm
Reply with quote

Hi Srivastava,

U can use following sort card

Code:
INREC FIELDS=(1,80,SEQNUM,8,ZD)                                 
SORT FIELDS=(81,8,ZD,D)                                         
OUTFIL FILES=1,ENDREC=1,OUTREC=(1,80)
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Mon Oct 01, 2007 1:15 pm
Reply with quote

Ekta,

Quote:
Anyone know how to omit the last record in SYNCSORT?


Quote:
OUTFIL FILES=1,ENDREC=1,OUTREC=(1,80)


Should not be -

Code:
OUTFIL FILES=1,STARTREC=2OUTREC=(1,80)
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Mon Oct 01, 2007 1:17 pm
Reply with quote

Quote:
OUTFIL FILES=1,STARTREC=2OUTREC=(1,80)


Sorry icon_redface.gif forgot to put ',' between STARTREC & OUTREC in my prev post.
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Mon Oct 01, 2007 1:19 pm
Reply with quote

Hi Murali,

Yeap u r right ,I have misread the post .yeap it should be

Shrivatsa,

Code:
INREC FIELDS=(1,80,SEQNUM,8,ZD)                                 
SORT FIELDS=(81,8,ZD,D)                                         
OUTFIL FILES=1,STARTREC=2,OUTREC=(1,80)

But it will show the output in reverse order & if u want to see the record in orignal order than let me know i will provide u the sort card
Back to top
View user's profile Send private message
shrivatsa
Warnings : 1

Active User


Joined: 17 Mar 2006
Posts: 174
Location: Bangalore

PostPosted: Mon Oct 01, 2007 2:01 pm
Reply with quote

Murali,

Your control card is working as you told. As you gussed I need in original order. So can you please provide the same.


Thanks
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Mon Oct 01, 2007 2:08 pm
Reply with quote

Hi Shrivatsa,


Just add one more Step after this step.

Code:
INREC FIELDS=(1,80,SEQNUM,8,ZD)                                 
SORT FIELDS=(81,8,ZD,D) 
OUTFIL FILES=1,OUTREC=(1,80)


Or otherwise if u know the number of record in ur i/p file then use following sortcard it will solve ur problem in one step

Code:
OPTION COPY
OUTFIL FILES=1,ENDREC=N
Back to top
View user's profile Send private message
Ajay Baghel

Active User


Joined: 25 Apr 2007
Posts: 206
Location: Bangalore

PostPosted: Mon Oct 01, 2007 7:53 pm
Reply with quote

Here N should be total no of records - 1
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Tue Oct 02, 2007 6:56 am
Reply with quote

Ajay,
Quote:
Here N should be total no of records - 1

Are you sure? 'ENDREC=1' copies only ONE record to OP file.

Please note 'N' should be your record count-1.
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Tue Oct 02, 2007 6:59 am
Reply with quote

Ajay,

Since total no of records is highlighted and not '-1' part, I misunderstood the post. Sorry......... icon_redface.gif
Back to top
View user's profile Send private message
saptagiri kintali

New User


Joined: 21 Sep 2007
Posts: 20
Location: chennai

PostPosted: Wed Oct 03, 2007 3:56 pm
Reply with quote

hi,
u can omit the last record
u can use STOPAFT=(no.of records-1) in your sort card by using " sort" ,it willl help u when u know no.of records only..otherwise find no.of records as shown by others
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 INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
Search our Forums:

Back to Top