|
View previous topic :: View next topic
|
| Author |
Message |
ursvmg
New User
Joined: 24 May 2007 Posts: 52 Location: Chennai
|
|
|
|
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 |
|
 |
cpuhawg
Active User

Joined: 14 Jun 2006 Posts: 331 Location: Jacksonville, FL
|
|
|
|
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 |
|
 |
Aaru
Senior Member

Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
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 |
|
 |
rajatbagga
Active User

Joined: 11 Mar 2007 Posts: 199 Location: india
|
|
|
|
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 |
|
 |
Anuj Dhawan
Superior Member

Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
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 |
|
 |
ursvmg
New User
Joined: 24 May 2007 Posts: 52 Location: Chennai
|
|
|
|
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 |
|
 |
raak
Active User

Joined: 23 May 2006 Posts: 166 Location: chennai
|
|
|
|
i used the same ode and its working fine for me...
can u post ur sysout details..and syncsort version |
|
| Back to top |
|
 |
ursvmg
New User
Joined: 24 May 2007 Posts: 52 Location: Chennai
|
|
|
|
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 |
|
 |
acevedo
Active User

Joined: 11 May 2005 Posts: 344 Location: Spain
|
|
|
|
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 |
|
 |
ursvmg
New User
Joined: 24 May 2007 Posts: 52 Location: Chennai
|
|
|
|
Is there any other trick you experts know to achieve this?
Thanks,
ursvmg |
|
| Back to top |
|
 |
shankar.v
Active User
Joined: 25 Jun 2007 Posts: 196 Location: Bangalore
|
|
|
|
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 |
|
 |
Anuj Dhawan
Superior Member

Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
| 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...  |
|
| Back to top |
|
 |
Devzee
Active Member
Joined: 20 Jan 2007 Posts: 684 Location: Hollywood
|
|
|
|
Anuj
| Quote: |
| SYNCSORT FOR Z/OS 1.1DR |
This is SYNCSORT version
This is z/OS version and not SYNCSORT version.
Latest version from SYNCSORT is 1.3 |
|
| Back to top |
|
 |
ursvmg
New User
Joined: 24 May 2007 Posts: 52 Location: Chennai
|
|
|
|
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 |
|
 |
Anuj Dhawan
Superior Member

Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
Oh..k. i didn't see that.
Thnak You Devzee for getting me on track..  |
|
| Back to top |
|
 |
acevedo
Active User

Joined: 11 May 2005 Posts: 344 Location: Spain
|
|
|
|
| yeap, I read SYNCSORT FOR Z/OS 1.1. |
|
| Back to top |
|
 |
Anuj Dhawan
Superior Member

Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
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 |
|
 |
Alissa Margulies
SYNCSORT Support
Joined: 25 Jul 2007 Posts: 496 Location: USA
|
|
|
|
| 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 |
|
 |
acevedo
Active User

Joined: 11 May 2005 Posts: 344 Location: Spain
|
|
|
|
| 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 |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|