|
View previous topic :: View next topic
|
| Author |
Message |
mahesh83
New User
Joined: 29 Jan 2008 Posts: 14 Location: Bangalore
|
|
|
|
Hello,
Using syncsort , in a single SORT step i want to know how to copy first 25 records from input file and include a condition after that.
Ex: From the input file , copy first 25 records as it is and filter out the records with string equal 'ELEMENT' after that.
Am able to do one of the req where i have extracted the records with string equal 'ELEMENT.
000001 SORT FIELDS=COPY
000002 INCLUDE COND=(26,7,CH,EQ,C'ELEMENT')
Please let me know what is to be modified in the above SORT card to copy the first 25 records of the input file. |
|
| Back to top |
|
 |
bipinpeter
Active User
.jpg)
Joined: 18 Jun 2007 Posts: 213 Location: Cochin/Kerala/India
|
|
|
|
Hi Mahesh,
Please try this code,
I am assuming your file length is 80 byte,
| Code: |
SORT FIELDS=COPY
INREC FIELD=(1,80,81:SEQNUM,8,ZD)
INCLUDE COND=(26,7,CH,EQ,C'ELEMENT',OR,81,8,ZD,LE,25)
OUTREC FILEDS=(1,80) |
|
|
| Back to top |
|
 |
dbzTHEdinosauer
Global Moderator

Joined: 20 Oct 2006 Posts: 6965 Location: porcelain throne
|
|
|
|
| delete by poster |
|
| Back to top |
|
 |
mahesh83
New User
Joined: 29 Jan 2008 Posts: 14 Location: Bangalore
|
|
|
|
Hi Bipin,
File recfm is FBA and LRECL(Inp/Output) is 133
I want both the requirement shoudl happen..
i.e copy the first 25 records and string equal 'ELEMENT. |
|
| Back to top |
|
 |
bipinpeter
Active User
.jpg)
Joined: 18 Jun 2007 Posts: 213 Location: Cochin/Kerala/India
|
|
|
|
Hi Mahesh,
try this code,
[/code]SORT FIELDS=COPY
INREC FIELD=(1,133,134:SEQNUM,8,ZD)
INCLUDE COND=(26,7,CH,EQ,C'ELEMENT',OR,134,8,ZD,LE,25)
OUTREC FILEDS=(1,133) |
|
| Back to top |
|
 |
mahesh83
New User
Joined: 29 Jan 2008 Posts: 14 Location: Bangalore
|
|
|
|
hi Bipin,
I have already tried this..Please find the below sysout mess which says beyond the record.
The seqnum inserted adds up the LRECL of the INREC to 141 instead of 133.
SYSIN :
SORT FIELDS=COPY
INREC FIELDS=(1,133,134:SEQNUM,8,ZD)
INCLUDE COND=((134,8,ZD,LE,25),AND,
(26,7,CH,EQ,C'ELEMENT'))
OUTREC FIELDS=(1,133)
WER276B SYSDIAG= 236280, 1454296, 1454296, 2806275
WER164B 5,140K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,
WER164B 100K BYTES RESERVE REQUESTED, 1,008K BYTES USED
WER146B 16K BYTES OF EMERGENCY SPACE ALLOCATED
WER108I SORTIN : RECFM=FBA ; LRECL= 133; BLKSIZE= 2660
WER257I INREC RECORD LENGTH = 141
WER238I POTENTIALLY INEFFICIENT USE OF INREC
WER237I OUTREC RECORD LENGTH = 133
WER110I SORTOUT : RECFM=FBA ; LRECL= 133; BLKSIZE= 2660
WER250A INCLUDE/OMIT FIELD BEYOND RECORD
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE |
|
| Back to top |
|
 |
ssmukul
New User
Joined: 22 Jan 2008 Posts: 19 Location: India
|
|
|
|
Hi Mahesh,
Please try this,
| Code: |
//SYSIN DD *
INREC IFTHEN=(WHEN=INIT,OVERLAY=(134:SEQNUM,8,ZD))
SORT FIELDS=COPY
OUTFIL INCLUDE=(134,8,ZD,LE,25),BUILD=(1,133)
/* |
Regards,
[/code] |
|
| Back to top |
|
 |
bipinpeter
Active User
.jpg)
Joined: 18 Jun 2007 Posts: 213 Location: Cochin/Kerala/India
|
|
|
|
Hi Mahesh,
Try the below code,
| Code: |
SORT FIELDS=COPY
INREC FIELD=(1,133,134:SEQNUM,8,ZD)
OUTFIL FNAMES=OUT,
INCLUDE=(26,7,CH,EQ,C'ELEMENT',OR,134,8,ZD,LE,25) ,
BUILD=(1,133)
|
|
|
| Back to top |
|
 |
ssmukul
New User
Joined: 22 Jan 2008 Posts: 19 Location: India
|
|
|
|
Sorry, I missed the second condn. in code in my previous post.
| Code: |
//SYSIN DD *
INREC IFTHEN=(WHEN=INIT,OVERLAY=(134:SEQNUM,8,ZD))
SORT FIELDS=COPY
OUTFIL INCLUDE=(134,8,ZD,LE,25,OR,26,7,CH,EQ,C'ELEMENT'),BUILD=(1,133)
/ |
|
|
| Back to top |
|
 |
mahesh83
New User
Joined: 29 Jan 2008 Posts: 14 Location: Bangalore
|
|
|
|
Its ok i have included that and now it is working..Thanks a ton
INREC IFTHEN=(WHEN=INIT,OVERLAY=(134:SEQNUM,8,ZD))
SORT FIELDS=COPY
OUTFIL INCLUDE=(134,8,ZD,LE,25,OR,26,7,CH,EQ,C'ELEMENT'),
BUILD=(1,133) |
|
| Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
mahesh83,
You don't really need a SEQNUM operator here, I guess this was enough.
| Code: |
//SYSIN DD *
SORT FIELDS=COPY,STOPAFT=25
OUTFIL INCLUDE=(26,7,CH,EQ,C'ELEMENT')
/* |
|
|
| Back to top |
|
 |
dbzTHEdinosauer
Global Moderator

Joined: 20 Oct 2006 Posts: 6965 Location: porcelain throne
|
|
|
|
Arun,
I think the TS wanted the
first 25
and then every record thereafter which contained 'ELEMENT' |
|
| Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
Hi Dick,
Oops, I misunderstood the requirement. My bad, thanks for pointing it out.  |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|