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

Sort a file excluding my header and trailer using SYNCSORT


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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: 183
Location: hyderabad

PostPosted: Tue Mar 13, 2007 5:10 pm
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: 3156
Location: Tucson AZ

PostPosted: Tue Mar 13, 2007 5:12 pm
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: 183
Location: hyderabad

PostPosted: Tue Mar 13, 2007 5:22 pm
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: 1208
Location: Bangalore,India

PostPosted: Tue Mar 13, 2007 7:08 pm
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
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

Moderator Emeritus


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

PostPosted: Tue Mar 13, 2007 11:25 pm
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
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

Moderator Emeritus


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

PostPosted: Wed Mar 14, 2007 8:17 am
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: 691
Location: Earth

PostPosted: Wed Mar 14, 2007 5:08 pm
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

Moderator Emeritus


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

PostPosted: Wed Mar 14, 2007 7:39 pm
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: 3156
Location: Tucson AZ

PostPosted: Wed Mar 14, 2007 7:46 pm
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

Moderator Emeritus


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

PostPosted: Wed Mar 14, 2007 8:21 pm
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: 691
Location: Earth

PostPosted: Thu Mar 15, 2007 12:52 pm
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

Moderator Emeritus


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

PostPosted: Thu Mar 15, 2007 7:08 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top