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
 

 

Copy selected records using Syncsort

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Copy selected records using Syncsort
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    Post subject:
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

Site Director


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

PostPosted: Tue Aug 11, 2009 7:29 pm    Post subject:
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: 2158
Location: @my desk

PostPosted: Tue Aug 11, 2009 7:44 pm    Post subject:
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

Senior Member


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

PostPosted: Tue Aug 11, 2009 9:48 pm    Post subject:
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    Post subject: Reply to: Syncsort
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    Post subject: Reply to: Syncsort
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    Post subject: Reply to: Syncsort
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    Post subject:
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

Site Director


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

PostPosted: Wed Aug 12, 2009 8:10 am    Post subject: Reply to: Copy selected records using Syncsort
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    Post subject: Reply to: Copy selected records using Syncsort
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Mon May 02, 2011 3:27 pm    Post subject: Reply to: Copy selected records using Syncsort
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

Senior Member


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

PostPosted: Mon May 02, 2011 3:40 pm    Post subject: Re: Reply to: Copy selected records using Syncsort
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: 8593
Location: Back in jolly old England

PostPosted: Mon May 02, 2011 3:56 pm    Post subject:
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

Senior Member


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

PostPosted: Mon May 02, 2011 4:29 pm    Post subject:
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    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 1 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
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm


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