View previous topic :: View next topic
|
Author |
Message |
khkalyan
New User
Joined: 14 May 2007 Posts: 5 Location: India
|
|
|
|
I have a file of 1000 records . I need to stop sorting after 570 records .
can any one of you resolve it. |
|
Back to top |
|
|
Raphael Bacay
New User
Joined: 04 May 2007 Posts: 58 Location: Manila, Philippines
|
|
|
|
There could be problems with your requirement. The problem is that for example, the lowest element is in the 1000th position. If you want to sort the first 570 records only, you will miss out the first element of the 1000 element file because you will never get to the first record with the 570 limit. You might want to just sort everything up, all 1000, and then extract the first 570 so you get the 570 records in sorted order. You can use IDCAMS-REPRO with COUNT for this or make a COBOL program to extract the first 570 elements.
If you insist that you only need the first 570 elements then you can just extract the first 570 records using IDCAMS-REPRO with COUNT or COBOL. Then you can use COBOL or JCL to sort the 570 element file into sorted order.
If you are going to try the IDCAMS option for extract you might want to use the REPRO parameter with syntax:
REPRO -
INFILE(VSAM) -
OUTFILE(SEQ) -
COUNT(N)
You can then use SYNCSORT or COBOL for the sorting. |
|
Back to top |
|
|
skkp2006
New User
Joined: 14 Jul 2006 Posts: 93 Location: Chennai,India
|
|
|
|
STOPAFT Parameter (Optional) (SyncSort OS/DOS compatible)
STOPAFT=n instructs SyncSort CMS to sort or copy only a decimal number (n) of records. These will be the first 'n' records after E15, INCLUDE/OMIT and SKIPREC processing.
The STOPAFT parameter may be specified on the OPTION control statement, but should not be specified on both the SORT statement and the OPTION statement for the same application.
STOPAFT may also be specified as an option on the SSORT command line. If it is, it overrides any STOPAFT parameters on the SyncSort CMS control statements. |
|
Back to top |
|
|
priyamnavada
New User
Joined: 24 Dec 2005 Posts: 52 Location: hyderabad
|
|
|
|
Use STOPAFT=570 |
|
Back to top |
|
|
khkalyan
New User
Joined: 14 May 2007 Posts: 5 Location: India
|
|
|
|
Sorry there is a confusion in my question.I want to write first 570 records of 1000 records in to separate output file.The processiong has to stop after wrirting 570 records. |
|
Back to top |
|
|
SHAILESH OZA
New User
Joined: 10 Jun 2005 Posts: 21 Location: Mumbai
|
|
|
|
Hi Chankravarti,
you can follow the below steps
1) First read the 570 records from the input file File1 and write these records into the output file2.
2) Then Sort the file2.
3) Then simply read the input file1 upto the record 570(you can use perform 570 times).
4) After that open the file2 in extend mode and append the records into it
after making sure that your pointer in the input file is at the record 571.
This is the logic only . Bytherway i will try to implement it and let you know |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
Hi khkalyan,
Used below JCL to check STOPAFT. It's working fair enough for your requirement.
Code: |
//JOBCARD
//*
//STEP050 EXEC PGM=SORT,REGION=4096K
//*
//SORTIN DD DSN=HLQ.TEMP.FILE,
// DISP=SHR
//SORTOUT DD DSN=HLQ.TEMP.FILE1,
// DISP=(NEW,CATLG,CATLG),
// DSORG=PS,
// RECFM=FB,
// DATACLAS=LARGE,
// UNIT=SYSDA
//SORTWK01 DD UNIT=SYSDA,SPACE=(CYL,(20,5))
//SYSIN DD *
SORT FIELDS=(1,10,CH,A),STOPAFT=5
/*
//SORTMSG DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//CEEDUMP DD SYSOUT=*
//* |
Data in i/p:HLQ.TEMP.FILE
Code: |
9000000000
8000000000
7000000000
6000000000
5000000000
4000000000
3000000000
2000000000
1000000000
0000000000 |
Data in o/p:
Code: |
5000000000
6000000000
7000000000
8000000000
9000000000 |
Hope it helps. |
|
Back to top |
|
|
khkalyan
New User
Joined: 14 May 2007 Posts: 5 Location: India
|
|
|
|
Hi this is ok.But I need to do with JCL. |
|
Back to top |
|
|
khkalyan
New User
Joined: 14 May 2007 Posts: 5 Location: India
|
|
|
|
HI PRIYA THANKS A LOT
I GOT THE OUT FILE |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
Hi,
Just wanted to add the following in above,
I/P file contains 10 records & I want to stop sort after 5 records OR in other words, I want to sort first 5 records only.
for your situation:
I/P file contains 1000 records & you want to stop sort after 570 records OR in other words, want to sort first 570 records only.
Hope you got the solution. |
|
Back to top |
|
|
khkalyan
New User
Joined: 14 May 2007 Posts: 5 Location: India
|
|
|
|
HI ANJU I HAVE DONE LIKE THAT ONLY BUT I HAVE GIVEN LIKE THIS
//SYSIN DD *
OPTION COPY,
STOPAFT=5
/* |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
oopss..!..
my answer came bit late.! |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
aha..!!
You got the solution..good..!
By the way my name is Anuj & not Anju |
|
Back to top |
|
|
ramfrom84
New User
Joined: 23 Aug 2006 Posts: 93 Location: chennai
|
|
|
|
HI ,
U can use STOPAFT in SORT similar in the IDCAMS we have one more Option
REPRO INFILE(INDD) OUTFILE(OUTDD0) SKIP(No of records) COUNT(mno of records)
Code: |
//R010 EXEC PGM=CONDCODE,PARM=IDCAMS
//SYSPRINT DD SYSOUT=*
//INDD DD DSN=Input File ,DISP=SHR
//OUTDD0 DD DSN=Output File,
// DISP=(,CATLG,DELETE),
// UNIT=SYSDA,
// STORCLAS=CTSDASD,
// DATACLAS=COMPRESS,
// AVGREC=K,
// SPACE=(1250,(1500,600),RLSE),
// DCB=(RECFM=FB,LRECL=1250)
//SYSIN DD *
REPRO INFILE(INDD) OUTFILE(OUTDD0) SKIP(No of records) COUNT(mno of records)
/*
//SYSOUT DD SYSOUT=*
//*
// |
This would be better for ur requriment if it is o/p is VSAM File..
Thanks.. |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
ramfrom84 wrote: |
HI ,
U can use STOPAFT in SORT similar in the IDCAMS we have one more Option
|
I used STOPAFT in SORT only.. . I didn't get you.
& what is CONDCODE in your JCL? When I tried your JCL, here at my site, got the message "Program CONDCODE not found". Please suggest. |
|
Back to top |
|
|
ramfrom84
New User
Joined: 23 Aug 2006 Posts: 93 Location: chennai
|
|
|
|
Soory guys,, U can use IDCAMS, for Normal REPRO here.., It ll work... forgot about CONDCODE....
Code: |
//R010 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//INDD DD DSN=Input File ,DISP=SHR
//OUTDD0 DD DSN=Output File,
// DISP=(,CATLG,DELETE),
// UNIT=SYSDA,
// STORCLAS=CTSDASD,
// DATACLAS=COMPRESS,
// AVGREC=K,
// SPACE=(1250,(1500,600),RLSE),
// DCB=(RECFM=FB,LRECL=1250)
//SYSIN DD *
REPRO INFILE(INDD) OUTFILE(OUTDD0) SKIP(No of records) COUNT(mno of records)
/*
//SYSOUT DD SYSOUT=*
//*
// |
Thanks for correct me... |
|
Back to top |
|
|
|