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

Syncsort: COPY First 25 records and include a condtion after


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

New User


Joined: 29 Jan 2008
Posts: 14
Location: Bangalore

PostPosted: Wed Jul 21, 2010 2:10 pm
Reply with quote

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
View user's profile Send private message
bipinpeter

Active User


Joined: 18 Jun 2007
Posts: 213
Location: Cochin/Kerala/India

PostPosted: Wed Jul 21, 2010 2:30 pm
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Jul 21, 2010 2:36 pm
Reply with quote

delete by poster
Back to top
View user's profile Send private message
mahesh83

New User


Joined: 29 Jan 2008
Posts: 14
Location: Bangalore

PostPosted: Wed Jul 21, 2010 3:00 pm
Reply with quote

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
View user's profile Send private message
bipinpeter

Active User


Joined: 18 Jun 2007
Posts: 213
Location: Cochin/Kerala/India

PostPosted: Wed Jul 21, 2010 3:20 pm
Reply with quote

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
View user's profile Send private message
mahesh83

New User


Joined: 29 Jan 2008
Posts: 14
Location: Bangalore

PostPosted: Wed Jul 21, 2010 3:27 pm
Reply with quote

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
View user's profile Send private message
ssmukul

New User


Joined: 22 Jan 2008
Posts: 19
Location: India

PostPosted: Wed Jul 21, 2010 3:46 pm
Reply with quote

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
View user's profile Send private message
bipinpeter

Active User


Joined: 18 Jun 2007
Posts: 213
Location: Cochin/Kerala/India

PostPosted: Wed Jul 21, 2010 3:47 pm
Reply with quote

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
View user's profile Send private message
ssmukul

New User


Joined: 22 Jan 2008
Posts: 19
Location: India

PostPosted: Wed Jul 21, 2010 4:01 pm
Reply with quote

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
View user's profile Send private message
mahesh83

New User


Joined: 29 Jan 2008
Posts: 14
Location: Bangalore

PostPosted: Wed Jul 21, 2010 4:12 pm
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Wed Jul 21, 2010 7:30 pm
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Jul 21, 2010 7:34 pm
Reply with quote

Arun,

I think the TS wanted the
first 25
and then every record thereafter which contained 'ELEMENT'
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Wed Jul 21, 2010 10:04 pm
Reply with quote

Hi Dick,

Oops, I misunderstood the requirement. My bad, thanks for pointing it out. icon_sad.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 INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts VB to VB copy - Full length reached SYNCSORT 8
No new posts Join multiple records using splice DFSORT/ICETOOL 5
Search our Forums:

Back to Top