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
 

 

Omit Last Record in Sort

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
shrivatsa
Warnings : 1

Active User


Joined: 17 Mar 2006
Posts: 171
Location: Bangalore

PostPosted: Mon Oct 01, 2007 12:47 pm    Post subject: Omit Last Record in Sort
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: 1187
Location: Bangalore,India

PostPosted: Mon Oct 01, 2007 1:07 pm    Post subject:
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: 1439
Location: Bangalore,India

PostPosted: Mon Oct 01, 2007 1:15 pm    Post subject:
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: 1439
Location: Bangalore,India

PostPosted: Mon Oct 01, 2007 1:17 pm    Post subject:
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: 1187
Location: Bangalore,India

PostPosted: Mon Oct 01, 2007 1:19 pm    Post subject:
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: 171
Location: Bangalore

PostPosted: Mon Oct 01, 2007 2:01 pm    Post subject: Reply to: Omit Last Record in Sort
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: 1187
Location: Bangalore,India

PostPosted: Mon Oct 01, 2007 2:08 pm    Post subject:
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: 205
Location: Bangalore

PostPosted: Mon Oct 01, 2007 7:53 pm    Post subject: Reply to: Omit Last Record in Sort
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: 1439
Location: Bangalore,India

PostPosted: Tue Oct 02, 2007 6:56 am    Post subject:
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: 1439
Location: Bangalore,India

PostPosted: Tue Oct 02, 2007 6:59 am    Post subject:
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    Post subject:
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    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 Record Not found in AlX but record re... mukun264 COBOL Programming 2 Fri Mar 24, 2017 9:28 am
No new posts Count the length of the record & ... sreekusr DFSORT/ICETOOL 4 Thu Mar 23, 2017 7:52 pm
No new posts Innovations in Your Mainframe Sort Arun Raj PC Guides & IT News 4 Wed Mar 15, 2017 10:38 pm
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm
No new posts SORT requirement sjiraga COBOL Programming 6 Thu Mar 09, 2017 9:11 pm


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