Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
shrivatsa
Warnings : 1

Active User

Joined: 17 Mar 2006
Posts: 171
Location: Bangalore

 Posted: Mon Oct 01, 2007 12:47 pm    Post subject: Omit Last Record in Sort Anyone know how to omit the last record in SYNCSORT?

guptae

Moderator

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

Posted: Mon Oct 01, 2007 1:07 pm    Post subject:

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)
murmohk1

Senior Member

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

Posted: Mon Oct 01, 2007 1:15 pm    Post subject:

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)
murmohk1

Senior Member

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

Posted: Mon Oct 01, 2007 1:17 pm    Post subject:

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

Sorry forgot to put ',' between STARTREC & OUTREC in my prev post.
guptae

Moderator

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

Posted: Mon Oct 01, 2007 1:19 pm    Post subject:

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
shrivatsa
Warnings : 1

Active User

Joined: 17 Mar 2006
Posts: 171
Location: Bangalore

 Posted: Mon Oct 01, 2007 2:01 pm    Post subject: Reply to: Omit Last Record in Sort 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
guptae

Moderator

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

Posted: Mon Oct 01, 2007 2:08 pm    Post subject:

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
Ajay Baghel

Active User

Joined: 25 Apr 2007
Posts: 205
Location: Bangalore

 Posted: Mon Oct 01, 2007 7:53 pm    Post subject: Reply to: Omit Last Record in Sort Here N should be total no of records - 1
murmohk1

Senior Member

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

Posted: Tue Oct 02, 2007 6:56 am    Post subject:

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

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

murmohk1

Senior Member

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

 Posted: Tue Oct 02, 2007 6:59 am    Post subject: Ajay, Since total no of records is highlighted and not '-1' part, I misunderstood the post. Sorry.........
saptagiri kintali

New User

Joined: 21 Sep 2007
Posts: 20
Location: chennai

 Posted: Wed Oct 03, 2007 3:56 pm    Post subject: 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
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics How to Generate JCL using Sort naveen katkuri DFSORT/ICETOOL 7 Tue Mar 13, 2018 3:50 pm Need better approach to create a sort... Vamshi Veludandi DFSORT/ICETOOL 8 Thu Mar 08, 2018 5:59 pm Can we merge these two sort cards int... abdulrafi JCL & VSAM 2 Thu Mar 08, 2018 4:03 pm SORT CARD ram_vizag DFSORT/ICETOOL 13 Thu Mar 01, 2018 4:55 am Copying only first and last word from... chandan.inst SYNCSORT 4 Wed Jan 31, 2018 4:19 pm

 © 2003-2017 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us