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

Copy selected records using Syncsort


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

New User


Joined: 20 Nov 2008
Posts: 9
Location: Delhi

PostPosted: Tue Aug 11, 2009 9:56 am
Reply with quote

A Seq. file contains 10 records. We wamt to copy 4th & 7 th records in single step using sort How ?
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Tue Aug 11, 2009 10:33 am
Reply with quote

Hi RajKumar,
Give appropriate titles to your topics.

Which sort product you are using?

If you are using DFSORT then you can use below solution..
Code:

//S1    EXEC  PGM=ICETOOL                                   
//DFSMSG    DD  SYSOUT=*                                     
//TOOLMSG   DD  SYSOUT=*                                     
//IN DD your input file here                                                   
//OUT DD SYSOUT=*                                           
//TOOLIN   DD    *                                           
  SUBSET FROM(IN) TO(OUT) KEEP INPUT RRN(4) RRN(7)           
/*                                                           
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Aug 11, 2009 7:29 pm
Reply with quote

Hello,

Quote:
Which sort product you are using?
While meaningless as a title/subject, "Syncsort" does let us know which sort product. . . icon_smile.gif

Syncsort now includes SUBSET, but a current release must be used - possibly 1.3.2.
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Tue Aug 11, 2009 7:44 pm
Reply with quote

dick scherrer wrote:
"Syncsort" does let us know which sort product. . . icon_smile.gif
Hi Dick,

I think when the topic started, the title was just a "Sort". Dont know how it changed 'automatically'. icon_lol.gif
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


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

PostPosted: Tue Aug 11, 2009 9:48 pm
Reply with quote

If this has to do just with 4th and 7th record- why not use ISPF copy/paste options? As framed, this query does not sound like a business requirement...

PS.: Posting same question on muliple help baords is not considered as a good habit...
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Tue Aug 11, 2009 10:25 pm
Reply with quote

rajkumarprajapati,

You may want try the below SORT job if your site does not have latest version of SORT installed.

Code:

//STEP0001 EXEC  PGM=SORT                         
//SYSOUT   DD SYSOUT=*                           
//SORTOUT  DD DSN=&&TEMP1,DISP=(NEW,PASS,DELETE),
//            SPACE=(CYL,(1,1),RLSE)             
//SORTIN   DD *                                   
REC1                                             
REC2                                             
REC3                                             
REC4                                             
REC5                                             
REC6                                             
REC7                                             
//SYSIN    DD *                                   
  INREC OVERLAY=(81:SEQNUM,8,ZD)                 
  OPTION COPY                                     
/*                                               
//STEP0002 EXEC  PGM=SORT                       
//SYSOUT   DD SYSOUT=*                           
//SORTIN   DD DSN=&&TEMP1,DISP=(OLD,PASS,DELETE),
//            SPACE=(CYL,(1,1),RLSE)             
//SORTOUT  DD SYSOUT=*                           
//SYSIN    DD *                                 
  OPTION COPY                                   
  INCLUDE COND=(81,8,ZD,EQ,4,OR,81,8,ZD,EQ,7)   
  OUTREC BUILD=(1,80)                           
/*       


Output:
Code:

REC4
REC7


I knew this one is inefficient one and seek experts suggestion to tweak it.

Thanks.
Back to top
View user's profile Send private message
ksathishkumar83

New User


Joined: 21 Nov 2006
Posts: 50
Location: India

PostPosted: Tue Aug 11, 2009 11:01 pm
Reply with quote

Hi,

You can do the above in a single Sort step using Syncsort.

//STEP0001 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTOUT DD SYSOUT=*
//SORTIN DD *
REC1
REC2
REC3
REC4
REC5
REC6
REC7
//SYSIN DD *
INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD))
SORT FIELDS=COPY
OUTFIL INCLUDE=(81,8,ZD,EQ,4,OR,81,8,ZD,EQ,7),BUILD=(1,80)
/*
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Tue Aug 11, 2009 11:32 pm
Reply with quote

Nice of you for letting me to know that..... icon_biggrin.gif
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Wed Aug 12, 2009 7:51 am
Reply with quote

Quote:
While meaningless as a title/subject, "Syncsort" does let us know which sort product. . .

It wasn't the same topic name When I replied. icon_confused.gif icon_confused.gif
Somebody changed later..
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Aug 12, 2009 8:10 am
Reply with quote

Hi Sambhaji,

Yup, Arun also mentioned that. . .

By the time i got to the party, it had already been changed icon_smile.gif

d
Back to top
View user's profile Send private message
cvijay784
Warnings : 1

New User


Joined: 18 Jun 2008
Posts: 54
Location: Colombo

PostPosted: Mon May 02, 2011 3:15 pm
Reply with quote

Hi,

When I used the following sort card with output file of 133 bytes, i get an error "Incompatible LRECL in output file".

//SYSIN DD *
INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD))
SORT FIELDS=COPY
OUTFIL INCLUDE=(81,8,ZD,EQ,4,OR,81,8,ZD,EQ,7),BUILD=(1,80)
/*

Should both the input and output files be of same LRECL?

Please clarify.

Thanks,
Vijay
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Mon May 02, 2011 3:27 pm
Reply with quote

would it be too much of an hassle for You to keep posting where You started Your issue ? icon_evil.gif

what kind of stupid remark
Quote:
When I used the following sort card with output file of 133 bytes, i get an error "Incompatible LRECL in output file".

and the card provide build a 80 bytes record

what else do You expect ? icon_evil.gif

anyway the input and output file can be of different length as long as the statement You use to build the output record provide a length congruent with the dcb of the dataset
learn how to post properly or You will get another official warning icon_cool.gif
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


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

PostPosted: Mon May 02, 2011 3:40 pm
Reply with quote

cvijay784 wrote:
Should both the input and output files be of same LRECL?
Looks like you have coded the value of LRECL in the DCB info of SORTOUT - if so, either omit that or modify your SYSIN parms. SORT products knows about the LRECL using SYSIN parameters. I usually avoid coding LRECL in DCB, BLKSIZE=0 is enough in most of the cases.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Mon May 02, 2011 3:56 pm
Reply with quote

Anuj,

From past experience, I do dislike the coding of BLKSIZE=0 in the JCl as under some circumstances if the SMS environment is not correctly set up the file really does end up with valid attributes for RECFM and LRECL but has a BLKSIZE equal to zero, which of course causes abends and other problems down the line.

IMO it is far better only to specify only the RECFM and LRECL values.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


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

PostPosted: Mon May 02, 2011 4:29 pm
Reply with quote

Yeah, that's correct. If SMS environment has not been correctly established then the BLKSIZE=0 will be honoured and the dataset will have that attribute, which makes the dataset invalid for processing by DFHSM, or any other ILM software you use BUT expat - I had been lucky enough to have the Storage admins like you, never faced scuh a problem icon_wink.gif.

PS. Point taken, Sir. icon_smile.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 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
No new posts EZT program to build a flat file with... All Other Mainframe Topics 9
Search our Forums:

Back to Top