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: 1187
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: 1187
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: 1187
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 SORT BUT RETAIN HIGHEST VALUE ON NON-... leondan22 DFSORT/ICETOOL 2 Thu Dec 14, 2017 8:13 pm query to fetch record which has only ... maxsubrat DB2 12 Mon Dec 11, 2017 5:03 pm Extract record for change in combinat... Trinadh DFSORT/ICETOOL 6 Thu Nov 23, 2017 3:32 pm Extract Record using range of Data scorp_rahul23 DFSORT/ICETOOL 3 Wed Nov 15, 2017 11:54 pm Squeeze record left so that zeroes ar... Vignesh Sid SYNCSORT 5 Fri Nov 10, 2017 1:40 pm

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