i have 1000 records in input file and i want to sort it and
the first 200 records to be placed in output file. how to
do that??

Answers were Sorted based on User's Feedback



i have 1000 records in input file and i want to sort it and the first 200 records to be placed in ..

Answer / kavya

Write a sort step to sort the entire file. Write another
sort step with the following sort card
SORT FIELDS=COPY,
STOPAFT=200
END

Is This Answer Correct ?    19 Yes 1 No

i have 1000 records in input file and i want to sort it and the first 200 records to be placed in ..

Answer / sudeep

sorry kavya is right.I haven't red the first part.sorting
the file completely at first.

Is This Answer Correct ?    3 Yes 0 No

i have 1000 records in input file and i want to sort it and the first 200 records to be placed in ..

Answer / felix

sorry. my previous answer is wrong.
use the following coding in JCL.
First u should sort the file using sort pgm. enter the
sorted file path in input data set.

//SYSIN DD*
REPRO
INDATASET(WRITE THE INPUT PATH)
OUTDATASET(WRITE THE OUTPUT PATH)
COUNT(200)

Is This Answer Correct ?    4 Yes 2 No

i have 1000 records in input file and i want to sort it and the first 200 records to be placed in ..

Answer / chinmay

//job1 job 65493,jena,class=a prty=9
//step1 exec pgm=sort
//sysprint dd sysout=*
//indd dd dsn=file1.cob, disp= shr
//outdd dd dsn=file2.cob, disp=(new,catlg,delete)
// unit=sysda,space=(cyl,4,2),rlse)
//sysin dd *
sort fields=(2,4,ch,a)
/*
//step2 exec pgm=idcams
//sysprint dd sysout=*
//sysin dd *
repro -
infile(indd)
outfile(outdd)
count(200)
/*
//

Is This Answer Correct ?    2 Yes 0 No

i have 1000 records in input file and i want to sort it and the first 200 records to be placed in ..

Answer / sivakumar sekharannair

Kavya's answer is correct.
i used the following control card
//SYSIN DD *
SORT FIELDS=(1,3,CH,A),
STOPAFT=8

Input file contained the following records
IMSDEVELOPER CSAA
IMSPRODSUPPORTXEROX
IMSTESTER EMDAC
IMSDEVELOPER CSAA
CICPRODSUPPORTXEROX
IMSTESTER EMDAC

The output i got was

CICPRODSUPPORTXEROX
DB2PRODSUPPORTEMDAC
IMSDEVELOPER XEROX
IMSDEVELOPER CSAA
IMSDEVELOPER CSAA
IMSPRODSUPPORTXEROX
IMSTESTER EMDAC
IMSTESTER EMDAC

Is This Answer Correct ?    1 Yes 0 No

i have 1000 records in input file and i want to sort it and the first 200 records to be placed in ..

Answer / sivakumar sekharannair

The input records shown in the above message contained a
few records9total 10 records) also which was misset while
cut/copy

Is This Answer Correct ?    0 Yes 0 No

i have 1000 records in input file and i want to sort it and the first 200 records to be placed in ..

Answer / lachchu

Can you please write C code for the same ?

Is This Answer Correct ?    0 Yes 0 No

i have 1000 records in input file and i want to sort it and the first 200 records to be placed in ..

Answer / satish

hi to all
the example is useful to our requirement,example is i have
some records and i sort it and first 5 records to be placed
in o/p file
//STEP1 EXEC PGM=SORT
//SORTIN DD *
b
c
d
e
f
g
h
i
j
k
l
/*
//OUT DD dsn=output file*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(1,1,CH,D)
outfil fnames=out,endrec=5
/*

Is This Answer Correct ?    0 Yes 0 No

i have 1000 records in input file and i want to sort it and the first 200 records to be placed in ..

Answer / msm

//SYSIN DD *
DEBUG ABEND
SORT FIELDS=(8,11,CH,A)
SORT FIELDS=COPY,STOPAFT=200
END

Is This Answer Correct ?    0 Yes 0 No

i have 1000 records in input file and i want to sort it and the first 200 records to be placed in ..

Answer / jeeva225

sort fields=copy
outfil files=1,startrec=1,endrec=200

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More JCL Interview Questions

I have a file in which I have 20 records. I want my first record to go into file 1 and second record to go in second file. I want to copy the alternate records like this in the two output files. How can I do this using JCL?

4 Answers  


How much space OS allocates when you create a PS or PDS?

4 Answers  


How do you override a parameter in Positional parameters?

4 Answers   Thomson Reuters,


Are there any set of rules for the names of the steps used in a job?

0 Answers  


How many positional parameters are there in job statement?

4 Answers  






There are a set of 10 files and a customer will be selecting random no of files(i.e they may be more than 2, may not be in the order).Sometimes he might just select one file or sometimes no files at all.How do you code a JCL for this? Is it possible to code just JCL alone for this problem?

9 Answers   Infosys,


What is meant by S0C7 system abend code?

8 Answers  


What is the purpose of the dd keylen parameter?

0 Answers  


which utility is used to sort a file in jcl?

0 Answers   IBM,


Suppose we have 5 steps in a job.No step should be executed After submitting every step in a job

2 Answers   AVB, IBM,


What is the difference between specifying DISP=OLD and DISP=SHR for a dataset?

5 Answers   CitiGroup,


I have 20 steps in a job... step01, 02....step17...step20. For some reason I want to execute step17 only if the return code for all the previous steps are less than or equal to 4. otherwise if return code for any of the previous 16 steps is greater than 4, then step17 should be bypassed. How do I do that ?? how and in which step should i formulate COND parameter

8 Answers  


Categories