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: COPY First 25 records and include a condtion after

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Syncsort: COPY First 25 records and include a condtion after
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: 208
Location: Cochin/Kerala/India

PostPosted: Wed Jul 21, 2010 2:30 pm    Post subject:
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    Post subject:
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    Post subject:
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: 208
Location: Cochin/Kerala/India

PostPosted: Wed Jul 21, 2010 3:20 pm    Post subject:
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    Post subject:
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    Post subject:
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: 208
Location: Cochin/Kerala/India

PostPosted: Wed Jul 21, 2010 3:47 pm    Post subject:
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    Post subject:
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    Post subject:
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: 2159
Location: @my desk

PostPosted: Wed Jul 21, 2010 7:30 pm    Post subject:
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    Post subject:
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: 2159
Location: @my desk

PostPosted: Wed Jul 21, 2010 10:04 pm    Post subject:
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    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 Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts Syncsort - Hard coded Value in output PORYES SYNCSORT 1 Thu Nov 03, 2016 9:23 am
This topic is locked: you cannot edit posts or make replies. How to pass the previous month date i... Suganya87 DFSORT/ICETOOL 5 Mon Oct 31, 2016 4:13 pm
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm


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