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
 

 

Sort a file excluding my header and trailer using SYNCSORT

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

New User


Joined: 13 Mar 2007
Posts: 3
Location: chennai

PostPosted: Tue Mar 13, 2007 4:40 pm    Post subject: Sort a file excluding my header and trailer using SYNCSORT
Reply with quote

Hi can i sort a file excluding my header and trailer rec using syncsort
Back to top
View user's profile Send private message

sril.krishy

Active User


Joined: 30 Jul 2005
Posts: 182
Location: hyderabad

PostPosted: Tue Mar 13, 2007 5:10 pm    Post subject:
Reply with quote

Hi,
Yes you can.Please show the i/p and expected o/p foramts with the file details(recfm,lrecl etc..).

Thank you
Krishy
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Tue Mar 13, 2007 5:12 pm    Post subject:
Reply with quote

How? By using an include or omit.
How do you identify the header and trailer recs?
Have you checked the manual?
Back to top
View user's profile Send private message
sril.krishy

Active User


Joined: 30 Jul 2005
Posts: 182
Location: hyderabad

PostPosted: Tue Mar 13, 2007 5:22 pm    Post subject:
Reply with quote

William,
1)Yes thru Include or Omit only.
2)that is the reason asked to show the i/p and o/p.

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

Moderator


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

PostPosted: Tue Mar 13, 2007 7:08 pm    Post subject:
Reply with quote

Hi Bill,

But if we want to include header & trailer in o/p file then please suggest the sort card

I/p File:
Code:
HEDRINF101D342005041300000010
000000000034 10191610022005030119890717FANDERSON
000000000034 21328400022005031019850705FLYONS
000000000034 C1817600022005030119000101FMITCHELL
000000000034 D1965890052005030120031203MBENTON
000000000034 B2529180062005030119940122MGONZALEZ
000000000034 42667570102005030119000101MMATHEW
000000000034 B2868070052005033019951005MSOLORIO
000000000034 C3548350072005030119660930FMACARIO
000000000034 F4078320032005032220050318FWILSON
TRALINF101D34200504130000001000294138


O/p should be
Code:
HEDRINF101D342005041300000010
000000000034 B2529180062005030119940122MGONZALEZ
000000000034 B2868070052005033019951005MSOLORIO
000000000034 C1817600022005030119000101FMITCHELL
000000000034 C3548350072005030119660930FMACARIO
000000000034 D1965890052005030120031203MBENTON
000000000034 F4078320032005032220050318FWILSON
000000000034 10191610022005030119890717FANDERSON
000000000034 21328400022005031019850705FLYONS
000000000034 42667570102005030119000101MMATHEW
TRALINF101D34200504130000001000294138


Recfm:FB
Sort fields:(14,10,CH,A)
Back to top
View user's profile Send private message
getvichu

New User


Joined: 13 Mar 2007
Posts: 3
Location: chennai

PostPosted: Tue Mar 13, 2007 7:37 pm    Post subject: Re: Sort a file excluding my header and trailer using SYNCSO
Reply with quote

I VE GIVEN MY INPUT FILE FORMAT

. UM201AAB07031018030185 --HEAD
1200703101803032719321072937379062144211003124000W
1200703101803032719322664690379062144211003124000W
1200703101803032719321276074379062144211003124000W
1200703101803032719320123145379062144211003124000W
1200703101803032719321007479379062144211003124000W
1200703101803032719301658291379062144211003124000W
1200703101803032719320225833379062144211003124000W
.002278171 --TRAIL

LEAVING HEADER AND TRAILER AND THE REST OF THE RECORDS SHOULD BE SORTED IN ASC ORDER STARTING FROM COLUMN 19 TO 29

MY OUTPUT FILE HAS TO BE IN THE SAME FORMAT WITH HEADER AND TRAILER REC

CAN ANYONE HELP ME OUT
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Mar 13, 2007 11:25 pm    Post subject:
Reply with quote

Hello,

One way with Syncsort would be to read all of the original file into the sort.
In the control statements use a SORT statement and 3 OUTFIL statements.

Something like:
Code:
SORT FIELDS=(10,12,BI,A)
OUTFIL FILES=OUT,OMIT=(1,4,CH,EQ,C'HEDR',1,4,CH,EQ,C'TRAL')
OUTFIL FILES=HD,INCLUDE=(1,4,CH,EQ,C'HEDR')
OUTFIL FILES=TR,INCLUDE=(1,4,CH,EQ,C'TRAL')


This will require 3 output DD statements
//SORTOUT
//SORTOFHD
//SORTOFTR

Make all 3 with the same dcb info - sortout will need the same space as the input file, the other 2 will need only 1 track. If the file has hundreds of millions of records, this is not a good solution icon_smile.gif

After the sort step, run an IEBGENER to concatenate the 3 files into one file HD, OUT, TR.

There is probably a more elegant way, but that quickly came to mind.

On a similar note, if (when this file was designed) the file had a "record type" there would be no issue. If the first byte was a 1 for the hdr, 5 for detail records, and 8 for the trailer, the record type could be the high order "key" on any sort and the details would be in order by whatever key was needed for the detail data.
Back to top
View user's profile Send private message
getvichu

New User


Joined: 13 Mar 2007
Posts: 3
Location: chennai

PostPosted: Wed Mar 14, 2007 7:14 am    Post subject: Re: Sort a file excluding my header and trailer using SYNCSO
Reply with quote

Hi dick
Thanks a lot that was very useful..
but the sort card u mentioned cannot be used becoz the header and trailer rec cant be distinctly seperated with any key value..
1,4,ch,eq'hedr'------> but i don ve a char equal to hedr in my header rec
same for trailer rec too.. trailer rec is just the count of all the detail rec....

Plz help me to solve this
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Mar 14, 2007 8:17 am    Post subject:
Reply with quote

Hello,

No, that literal was for the example posted before your sample data. For yours, you would use the HEAD from this:
Code:
. UM201AAB07031018030185 --HEAD

and the TRAIL from this:
Code:
.002278171 --TRAIL


On those OUTFIL statements, you would use your "cols", not the ones from my example. You would also change the SORT to be the positions you want to sort on.
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 685
Location: Earth

PostPosted: Wed Mar 14, 2007 5:08 pm    Post subject:
Reply with quote

Guys, Got this from DFSORT tricks paper- icon_biggrin.gif

Code:

  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:C'1')),
    IFTHEN=(WHEN=(1,4,CH,EQ,C'HEDR'),OVERLAY=(81:C'0')),
    IFTHEN=(WHEN=(1,4,CH,EQ,C'TRAL'),OVERLAY=(81:C'9'))
  SORT FIELDS=(81,1,CH,A,19,29,CH,A)

Modify as per your requirement icon_wink.gif
By using a special key of '0' for the header record, '1' for the data records and '9' for the trailer records before the
regular key, we ensure that the header is first and the trailer is last. The '0' special key is unique and will be sorted
first so it's regular key doesn't matter. Likewise, the '9' special key for the trailer is unique and will be sorted last
so it's regular key doesn't matter. However, since all of the data records have the same special key of '1', they will
be sorted between the header and trailer, and the regular key will determine their order.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Mar 14, 2007 7:39 pm    Post subject:
Reply with quote

Hi Agkshirsagar,

Good catch icon_smile.gif

I like that much better than the OUTFIL method.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Wed Mar 14, 2007 7:46 pm    Post subject:
Reply with quote

I don't think Syncsort has that capability.... icon_confused.gif
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Mar 14, 2007 8:21 pm    Post subject:
Reply with quote

Hello,

Well, bummer. . . icon_sad.gif

Just did a Syncsort manual search and yup, IFTHEN is not there. . . Neither is OVERLAY.

Here's to the next release.
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 685
Location: Earth

PostPosted: Thu Mar 15, 2007 12:52 pm    Post subject:
Reply with quote

It's using DFSORT (ICEMAN).
(Original post said "using Syncsort" which I ignored. Sorry for that.)
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu Mar 15, 2007 7:08 pm    Post subject:
Reply with quote

No to worry - we all mis-read one periodically 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 SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Syncsort Help to group fields sudhakarraju SYNCSORT 6 Thu Dec 29, 2016 1:38 am
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts syncsort: copy lines after the keyword shreya19 SYNCSORT 7 Fri Dec 02, 2016 9:47 am
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm


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