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

SYNCSORT sorting of recs except header and trailer


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ursvmg

New User


Joined: 24 May 2007
Posts: 52
Location: Chennai

PostPosted: Wed Feb 20, 2008 8:31 pm
Reply with quote

I'm trying to sort a flat file with header and trailer. I need to sort only the content records and the header and trailer should be untouched.

Is there any way to achieve this using SYNCSORT?

Thanks, ursvmg
Back to top
View user's profile Send private message
cpuhawg

Active User


Joined: 14 Jun 2006
Posts: 331
Location: Jacksonville, FL

PostPosted: Wed Feb 20, 2008 8:50 pm
Reply with quote

Just use the OMIT statement under your SORT FIELDS=???? statement.

Code:

  OMIT COND=((1,6,CH,EQ,C'HEADER'),OR,(1,7,EQ,CH,C'TRAILER')) 


You can use the specific information in the fields that identify your HEADER and TRAILER records.
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1287
Location: Chennai, India

PostPosted: Thu Feb 21, 2008 4:58 am
Reply with quote

ursvmg,

Is there only one header/trailer in the flat file? or like the one shn below?

HD1
1
2
3
TR1
HD2
4
5
6
TR2
Back to top
View user's profile Send private message
rajatbagga

Active User


Joined: 11 Mar 2007
Posts: 199
Location: india

PostPosted: Thu Feb 21, 2008 7:24 am
Reply with quote

Hi ursvmg,

Please show a example of the records in your input files and the expected output records. That will help us in understanding your requirement in better manner....
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Thu Feb 21, 2008 8:31 am
Reply with quote

Hi,

You need to provide a little bit more information:

1. As asked earlier by Aaru, does the input file contain single header & trailer?

2. How header & Trailer can be identified? Does Header contain "H" & Trailer "T" or some other unique qualifier for them.

By the time try below code:
Code:
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
HDR
Detail Record
Detail Record
Detail Record
TRL
/*
//SORTOUT DD DSN=... output file
//SYSIN DD *
INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:C'1')),
IFTHEN=(WHEN=(1,4,CH,EQ,C'HDR'),OVERLAY=(81:C'0')),
IFTHEN=(WHEN=(1,4,CH,EQ,C'TRL'),OVERLAY=(81:C'9'))
SORT FIELDS=(81,1,CH,A,1,10,CH,A)
OUTREC FIELDS=(1,80)
/


In this SORTOUT is of LRECl 80 & detail records are SORTed from position 1 to 10. And yes SORTIN has only one Header (HDR) & one trailer (TLR).
Back to top
View user's profile Send private message
ursvmg

New User


Joined: 24 May 2007
Posts: 52
Location: Chennai

PostPosted: Thu Feb 21, 2008 10:24 am
Reply with quote

Hi all,
My input file is of below format:

h19022007
236..........
123..........
021..........
454..........
t000000004

My infile is of length 10.

I tried using the below code.


Code:
//SYSIN DD *
 INREC IFTHEN=(WHEN=INIT,OVERLAY=(11:C'1')),
 IFTHEN=(WHEN=(1,1,CH,EQ,C'H'),OVERLAY=(11:C'0')),
 IFTHEN=(WHEN=(1,1,CH,EQ,C'T'),OVERLAY=(11:C'9'))
 SORT FIELDS=(11,1,CH,A,1,3,CH,A)
 OUTREC FIELDS=(1,10)
/*



But it is giving "WER268A INREC STATEMENT : SYNTAX ERROR"

I need Output of this format:


h19022007
021..........
123..........
236..........
454..........
t000000004


I know I can do it in multiple sorts. I need to do it in a single sort using SYNCSORT as my environment dont have DFSORT utility.

Please let me know, if you need any other information.

Thanks,
ursvmg
Back to top
View user's profile Send private message
raak

Active User


Joined: 23 May 2006
Posts: 166
Location: chennai

PostPosted: Thu Feb 21, 2008 12:50 pm
Reply with quote

i used the same ode and its working fine for me...

can u post ur sysout details..and syncsort version
Back to top
View user's profile Send private message
ursvmg

New User


Joined: 24 May 2007
Posts: 52
Location: Chennai

PostPosted: Thu Feb 21, 2008 1:05 pm
Reply with quote

Here is the sysout:

SYNCSORT FOR Z/OS 1.1DR TPF3A U.S. PATENTS: 4210961, 5117495 (C) 2002 SYNC
z/OS 1.4.0
PRODUCT LICENSED FOR CPU SERIAL NUMBER 1AE2A, MODEL 2096 LICEN
SYSIN :
INREC IFTHEN=(WHEN=(1,1,CH,EQ,C'H'),OVERLAY=(11:C'0')),
*
IFTHEN=(WHEN=(1,1,CH,EQ,C'T'),OVERLAY=(11:C'9')),
IFTHEN=(WHEN=NONE,OVERLAY=(11:C'1'))
SORT FIELDS=(11,1,CH,A,1,3,CH,A)
OUTREC FIELDS=(1,10)
WER268A INREC STATEMENT : SYNTAX ERROR

Thanks,
ursvmg
Back to top
View user's profile Send private message
acevedo

Active User


Joined: 11 May 2005
Posts: 344
Location: Spain

PostPosted: Thu Feb 21, 2008 3:21 pm
Reply with quote

I think that you need release 1.3 in order to use IFTHEN feature.

Alissa Margulies can give you all this information.
Back to top
View user's profile Send private message
ursvmg

New User


Joined: 24 May 2007
Posts: 52
Location: Chennai

PostPosted: Thu Feb 21, 2008 3:32 pm
Reply with quote

Is there any other trick you experts know to achieve this?

Thanks,
ursvmg
Back to top
View user's profile Send private message
shankar.v

Active User


Joined: 25 Jun 2007
Posts: 196
Location: Bangalore

PostPosted: Thu Feb 21, 2008 4:18 pm
Reply with quote

Hi ursvmg,
Quote:
Is there any other trick you experts know to achieve this?

Please check with the following code for your requirement.
Code:
// EXEC PGM=ICETOOL
//DFSMSG DD SYSOUT=*
//TOOLMSG DD SYSOUT=*
//INFILE DD *
H19022007
021..........
123..........
236..........
454..........
T000000004
/*
//HEADER DD DSN=&&HEADER,DISP=(,DELETE)
//TRAILER DD DSN=&&TRAILER,DISP=(,DELETE)
//DETAIL DD DSN=&&DETAIL,DISP=(,DELETE)
//T DD DSN=*.HEADER,DISP=(OLD,DELETE),VOL=REF=*.HEADER
//  DD DSN=*.DETAIL,DISP=(OLD,DELETE),VOL=REF=*.DETAIL
//  DD DSN=*.TRAILER,DISP=(OLD,DELETE),VOL=REF=*.TRAILER
//OUT DD SYSOUT=*
//TOOLIN DD *
 COPY FROM(INFILE) TO(HEADER) USING(CTL1)
 SORT FROM(T) TO(OUT) USING(CTL2)
/*
//CTL1CNTL DD *
 OUTFIL FNAMES=HEADER,INCLUDE=(1,1,CH,EQ,C'H'),OUTREC=(1,80,C'0')
 OUTFIL FNAMES=TRAILER,INCLUDE=(1,1,CH,EQ,C'T'),OUTREC=(1,80,C'2')
 OUTFIL FNAMES=DETAIL,SAVE,OUTREC=(1,80,C'1')
/*
//CTL2CNTL DD *
 SORT FIELDS=(81,1,CH,A,1,3,CH,A)
 OUTFIL OUTREC=(1,80)
/*
//

Output:
Code:
H19022007     
021.......... 
123.......... 
236.......... 
454.......... 
T000000004   

Thanks,
Shankar
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Thu Feb 21, 2008 8:13 pm
Reply with quote

acevedo wrote:
I think that you need release 1.3 in order to use IFTHEN feature.
Quote:
SYNCSORT FOR Z/OS 1.1DR TPF3A U.S. PATENTS: 4210961, 5117495 (C) 2002 SYNC z/OS 1.4.0


I always thought that 'upgraded' version always keep the functionalities of previous releases. TSs' SYSOUT says that s/he is using 1.4.0 release, so shouldn't 1.3 release's feactures be avilable with Him... icon_confused.gif
Back to top
View user's profile Send private message
Devzee

Active Member


Joined: 20 Jan 2007
Posts: 684
Location: Hollywood

PostPosted: Thu Feb 21, 2008 8:22 pm
Reply with quote

Anuj
Quote:
SYNCSORT FOR Z/OS 1.1DR
This is SYNCSORT version

Quote:
z/OS 1.4.0
This is z/OS version and not SYNCSORT version.

Latest version from SYNCSORT is 1.3
Back to top
View user's profile Send private message
ursvmg

New User


Joined: 24 May 2007
Posts: 52
Location: Chennai

PostPosted: Thu Feb 21, 2008 8:50 pm
Reply with quote

Hi Shankar,

The piece of code, you have given works perfectly fine. Thanks a lot.

But i don't understand few stuff in that code.

Code:
//T DD DSN=*.HEADER,DISP=(OLD,DELETE),VOL=REF=*.HEADER
//  DD DSN=*.DETAIL,DISP=(OLD,DELETE),VOL=REF=*.DETAIL
//  DD DSN=*.TRAILER,DISP=(OLD,DELETE),VOL=REF=*.TRAILER


Does the above implies referbacking?

Code:
//CTL1CNTL DD *
 OUTFIL FNAMES=HEADER,INCLUDE=(1,1,CH,EQ,C'H'),OUTREC=(1,80,C'0')
 OUTFIL FNAMES=TRAILER,INCLUDE=(1,1,CH,EQ,C'T'),OUTREC=(1,80,C'2')
 OUTFIL FNAMES=DETAIL,SAVE,OUTREC=(1,80,C'1')
/*


What is actually happening in the above?

I kindly request you to explain the above.... If possible please provide a general flow of the program.

Regards,
ursvmg
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Fri Feb 22, 2008 3:35 am
Reply with quote

Oh..k. i didn't see that.

Thnak You Devzee for getting me on track.. icon_smile.gif
Back to top
View user's profile Send private message
acevedo

Active User


Joined: 11 May 2005
Posts: 344
Location: Spain

PostPosted: Sun Feb 24, 2008 3:49 pm
Reply with quote

yeap, I read SYNCSORT FOR Z/OS 1.1.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Mon Feb 25, 2008 1:01 am
Reply with quote

Hi acevedo,

Yeah I re-read the inforamtion posted by TS & got that He is using older version of syncsort (1.1).

However, I think He got he solution from Aaru's post.
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 496
Location: USA

PostPosted: Mon Feb 25, 2008 10:01 pm
Reply with quote

ursvmg wrote:
SYNCSORT FOR Z/OS 1.1DR TPF3A

SYSIN :
INREC IFTHEN=(WHEN=(1,1,CH,EQ,C'H'),OVERLAY=(11:C'0')),
*

WER268A INREC STATEMENT : SYNTAX ERROR

IFTHEN is supported in SyncSort for z/OS 1.2.1 and later.
Back to top
View user's profile Send private message
acevedo

Active User


Joined: 11 May 2005
Posts: 344
Location: Spain

PostPosted: Wed Feb 27, 2008 12:49 am
Reply with quote

IMHO...it would be good to open a new forum for Syncsort... to avoid moving posts from DFSORT forum to JCL forum...
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 Compare only first records of the fil... SYNCSORT 7
This topic is locked: you cannot edit posts or make replies. Automation need help in sorting the data DFSORT/ICETOOL 38
No new posts Insert header record with record coun... DFSORT/ICETOOL 14
No new posts Insert trailer for non empty file only DFSORT/ICETOOL 6
No new posts Creating CSV file from Variable recs ... DFSORT/ICETOOL 11
Search our Forums:

Back to Top