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

Explain about Internal Sort

1 Answers  


I have mainpgm(abc) this is the only cobol pgm(non-db2).And this pgm calling subpgm name "acd" this also only cobol(non- Db)and this pgm calling some other subpgm this pgm has cobol-db2 pgm. 1) IF you calling static mode how to run and how to compile? 2) IF you calling dynamic mode how to run and how to compile? plz suggestion me.

0 Answers   HP,


What is a PROC? What is the difference between an instream and a catalogued PROC?

2 Answers  


I have 15 flat files. each record in the files have the monthly salary for 12 months with the employee number. Now I want to concatenate the 15 files such that for the employee numbers that are common the o/p file should have only one record and the salaries should be concatenated to that record. How can we do it with JCL?

1 Answers  


how to code instream data in procedure?

3 Answers  


What do you do if you do not want to keep all the space allocated to a dataset?

2 Answers  


FOR a GDG, the book by 'SABA ZAMEER' says 'We can NOT ALTER the LIMIT parameter after it is defined'. (p-211). But many persons have written that it can be changed, which one is true ?

4 Answers   IBM,


if time parameter is not coded on the job card and job step then what is the default time assigned to the entire job and for each step in the job by the systyem ?

2 Answers   ITC Infotech,


Explain about LMCOPY -

1 Answers  


I have many files which i am receiving from client everyday. I have one step for every file to check for empty or not. Here client gives 30 files i need to check for every file for empty or not and i need to perform 30 steps. Can I do it in single step. Dynamically i need to change the File name in my step.

0 Answers  


How to override loadlib?

0 Answers   Fiserv,


Mention the types of job control statements?

0 Answers  


Categories