View previous topic :: View next topic
|
Author |
Message |
rajkumarprajapati
New User
Joined: 20 Nov 2008 Posts: 9 Location: Delhi
|
|
|
|
A Seq. file contains 10 records. We wamt to copy 4th & 7 th records in single step using sort How ? |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
Which sort product you are using? |
While meaningless as a title/subject, "Syncsort" does let us know which sort product. . .
Syncsort now includes SUBSET, but a current release must be used - possibly 1.3.2. |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
dick scherrer wrote: |
"Syncsort" does let us know which sort product. . . |
Hi Dick,
I think when the topic started, the title was just a "Sort". Dont know how it changed 'automatically'. |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
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 |
|
|
ramsri
Active User
Joined: 18 Oct 2008 Posts: 380 Location: India
|
|
|
|
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:
I knew this one is inefficient one and seek experts suggestion to tweak it.
Thanks. |
|
Back to top |
|
|
ksathishkumar83
New User
Joined: 21 Nov 2006 Posts: 50 Location: India
|
|
|
|
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 |
|
|
ramsri
Active User
Joined: 18 Oct 2008 Posts: 380 Location: India
|
|
|
|
Nice of you for letting me to know that..... |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
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.
Somebody changed later.. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hi Sambhaji,
Yup, Arun also mentioned that. . .
By the time i got to the party, it had already been changed
d |
|
Back to top |
|
|
cvijay784 Warnings : 1 New User
Joined: 18 Jun 2008 Posts: 54 Location: Colombo
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
|
|
would it be too much of an hassle for You to keep posting where You started Your issue ?
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 ?
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 |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
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 |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
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 |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
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 .
PS. Point taken, Sir. |
|
Back to top |
|
|
|