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
 

 

SYNCSORT sorting of recs except header and trailer

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: SYNCSORT sorting of recs except header and trailer
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    Post subject: Reply to: SYNCSORT sorting of recs except header and trailer
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: 1288
Location: Chennai, India

PostPosted: Thu Feb 21, 2008 4:58 am    Post subject: Reply to: SYNCSORT sorting of recs except header and trailer
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: 188
Location: india

PostPosted: Thu Feb 21, 2008 7:24 am    Post subject:
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

Senior Member


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

PostPosted: Thu Feb 21, 2008 8:31 am    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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

Senior Member


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

PostPosted: Thu Feb 21, 2008 8:13 pm    Post subject:
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    Post subject:
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    Post subject:
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

Senior Member


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

PostPosted: Fri Feb 22, 2008 3:35 am    Post subject:
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    Post subject:
Reply with quote

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

Senior Member


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

PostPosted: Mon Feb 25, 2008 1:01 am    Post subject:
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: 500
Location: USA

PostPosted: Mon Feb 25, 2008 10:01 pm    Post subject:
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    Post subject:
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    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 syncsort: copy lines after the keyword shreya19 SYNCSORT 7 Fri Dec 02, 2016 9:47 am
No new posts For each given key value, how to keep... Div Grad DFSORT/ICETOOL 7 Fri Nov 11, 2016 11:38 pm
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts Syncsort - Hard coded Value in output PORYES SYNCSORT 1 Thu Nov 03, 2016 9:23 am
No new posts Efficient sorting chandracdac DFSORT/ICETOOL 5 Sat Oct 22, 2016 3:23 am


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