How I sort the records in a file and copy the first 10
records to another file

Answers were Sorted based on User's Feedback



How I sort the records in a file and copy the first 10 records to another file..

Answer / kk

hi,

Using dfsort

//step10 exec pgm=sort
//sirtin dd dsn=userid.qulifier.psname,disp=shr
//sortout dd dsn=userid.qulifier.psname,disp=shr

sort fields=(starting position,length,cha,asc/dsc)
stopaft=10

now u get result sortout ps.

Is This Answer Correct ?    23 Yes 0 No

How I sort the records in a file and copy the first 10 records to another file..

Answer / balasukumar

//SORTIN DD DSN=INF1
//SORTOT DD DSN=OTF
//SYSIN DD *
SORT FIELDS = COPY
SKIP=0
STOPAFT=10
/*

Is This Answer Correct ?    6 Yes 1 No

How I sort the records in a file and copy the first 10 records to another file..

Answer / haleema

Keep first 10 sorted output records.
SUBSET FROM(IN1) TO(OUT1) OUTPUT KEEP FIRST(10)USING(CTL1)
//CTL1CNTL DD *
SORT FIELDS=(11,5,CH,A)
/*
Do this using ICETOOL job.

Is This Answer Correct ?    2 Yes 2 No

How I sort the records in a file and copy the first 10 records to another file..

Answer / srinivasa yadav

//sysin dd *
sort fields=(starting postion,length,data-type,order)
skip rec=0
stop rec=10
/*

and also we can use file-aid tool. in file-aid
there is an option 3.3

Is This Answer Correct ?    1 Yes 1 No

How I sort the records in a file and copy the first 10 records to another file..

Answer / girish kumar

just write like this

sysin dd *
sort fields=copy
stop after=10
/*
//
i tryed it's working

Is This Answer Correct ?    1 Yes 1 No

Post New Answer

More JCL Interview Questions

What is the max blocksize for a Tape file?

2 Answers  


what is A-MODE and R-MODE?

2 Answers  


Can we use COND=EVEN on a job card, when jobs are scheduled through scheduler?

5 Answers   L&T,


There is a procedure in A.B.PROCS(PROC1) (member name is PROC1) //PROCA... There is a call to a procedure PROCA from a JOB. //STEP01 EXEC PROCA ... Here "PROCA" in JOB refers to the actual PROC name or the member name of the PDS where this PROCA is stored.

2 Answers   Merrill Lynch,


what is alternate index?

1 Answers  






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  


Suppose I have seven jobs to do, but I want to hold one than how can I do this?

1 Answers  


How is a new GDG coded?

2 Answers  


I have a input file. Data like: ABCDEFGH.... i want out put file like AB BC CD DE....How can do this??

7 Answers   UST,


Ques: How can we code COND parameter in a JCL so that only even steps (or only odd steps) get execute??

3 Answers   HSBC,


I have three files for one step i need to override the third file how to do that in jcl?

1 Answers   UST,


I have one GDG. Everyday One new version is being created.Now I want to split this created version in different files each having 1000 records. Here Problem is I don't know How many records will be there in new version of GDG? that's why I don't know How many Out files we need to use . Interesting??????????????

4 Answers   CTS,


Categories