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

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,


I am getting the file from Unix to Mainframes for every 15 minutes. The mainframe job get abended with bad records coming from unix. I recovered that by deleting the bad data. I need permenant solution how to fix the issue? The record is getting characters in in first 9 positions which it should not. Please provide me the solution how to skip the records if it finds the charcters in the first 9 positions. K

3 Answers  


Why do you want to specify the REGION parameter in a JCL step?

4 Answers   Kekran Mekran, TCS,


Is acct parameter mandatory?

0 Answers  


What are three major types of JCL statements? What are their functions?

1 Answers  






what is a steplib

4 Answers   CGI,


In my job I have 6 steps. Step01,02,03...step06. after executing step02 i want to skip step03 and want to execute step04. and once step04 is done then I want to go back and execute step03. once step03 is completed I want execute step05, 06 and so on... can any one tell me how do i do that???

10 Answers   Perot Systems,


how can we pass external data to instream procedures

5 Answers   IBM, Infosys, Ocwen,


how to edit a tape dataset ? asked in wipro

1 Answers   Wipro,


What does a disposition of (new,catlg,keep) for a dsn mean?

0 Answers  


What does SYSIN * indicate?

2 Answers  


I have four steps in jcl they are STEP1,STEP2,STEP3 and STEP4. Can it possible to run the reverse order like step4 first then step3,step2,step1?

4 Answers   Broadridge, HCL,


Categories