If a field is declared as a comp-3 field and if we want to
sort a dataset based on this field, then how will the sort
card be???

e.g- if we want to sort by a field which is defined as a
PIC X(5) then we will mention - sort fields=(1,5,ch,a).
Likewise if a field is defined as PIC S9(10)COMP-3 then in
this case how will the sort field be defined (because in
this case a sign is also involved)???

Answers were Sorted based on User's Feedback



If a field is declared as a comp-3 field and if we want to sort a dataset based on this field, the..

Answer / bramar

Hi Albert,

I have a small doubt in your answer
for S9(10)COMP-3 the size will be 6 bytes
So I think it may be
sort fields=(1,6,PD,A)
Confirme weather my answer is right or wrong
Thanks in advance

Is This Answer Correct ?    14 Yes 2 No

If a field is declared as a comp-3 field and if we want to sort a dataset based on this field, the..

Answer / muttiah

Let's discuss what are all formats we have in sort
X/A - CH
Comp - BI
Comp-3- PD
9 - ZD/CH
So, Here we need to calculate how many bytes does the field
S9(10)comp-3 occupies.
10/2 + 1 = 5 + 1 = 6 bytes
Say field start's @ position 10then the sort command would
be like this..
Sort fields=(10,6,PD,A/D)
Hope this clarifies

Is This Answer Correct ?    9 Yes 0 No

If a field is declared as a comp-3 field and if we want to sort a dataset based on this field, the..

Answer / albert

We have to specify the sort card like below.

Sort fields=(1,5,PD,A) -> PD is packed decimal

Is This Answer Correct ?    12 Yes 6 No

If a field is declared as a comp-3 field and if we want to sort a dataset based on this field, the..

Answer / asish

Yes Bramar is right.
The sort card should be like this
sort fields=(1,6,PD,A)

Is This Answer Correct ?    6 Yes 3 No

If a field is declared as a comp-3 field and if we want to sort a dataset based on this field, the..

Answer / manikandan

yes bramar ur s correct...

s9(10) comp-3 allocate 6 bytes..so sort fields will be

sort fields=(1,6,pd,a)

Is This Answer Correct ?    3 Yes 2 No

If a field is declared as a comp-3 field and if we want to sort a dataset based on this field, the..

Answer / jegadeesan ramu

sort fields=(1,6,a),format=bi

Is This Answer Correct ?    6 Yes 5 No

If a field is declared as a comp-3 field and if we want to sort a dataset based on this field, the..

Answer / y@$w@nth

PIC S9(10)COMP-3

(n+1)/2 i.e (10+1)/2 11/2 =6(it fill follow round approach
if the result is in decimals)

so comp-3 allocates 6 bytes and the data inside comp-3 field
is stored in packed decimal format then we have to give

sort fields=(1,6,pd,a)
(or)
sort fields=(1,6,a) format=pd

Is This Answer Correct ?    2 Yes 1 No

If a field is declared as a comp-3 field and if we want to sort a dataset based on this field, the..

Answer / shailesh soni

Sort card for sorting Comp 3 field is
sort fields = (1,6,PD,A)

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More JCL Interview Questions

Given a input file with duplicates how to remove the duplicate records from the file using JCL?

6 Answers   CDS, Convergys, TCS,


I have 3 duplicate records in a file . I want to eliminate 1st, 2nd and copy 3rd one only . HOW ?

3 Answers   CTS, DELL,


What is the function of //jcllib statement?

0 Answers  


Differentiate between the joblib and the steplib statements?

0 Answers  


How do you designate a comment in JCL?

1 Answers  






how to identify a vasam dataset by seeing in 3.4(browse)

5 Answers   Cap Gemini,


What parameter of the job statement is used to limit the cpu time consumed by the job?

0 Answers  


I have 5 steps in my job. say s1, s2, s3, s4, s5 //s1 exec ............. //s2 exec ............ //s3 exec .......... //s4 exec ........ //s5 exec ............... my question is i want to exeute only s2 and s4 steps... please advice me how to do this:

4 Answers   ITC Infotech, TCS,


What is Automatic Restart ? EXEC PGM = PROG1, RD = R (Is it the Restart of a JOBSTEP or Restarting the execution of the program?) Do we Restart it or it automatically Restarts executing again and again ? Then when it will finish executing ? or After Abending, when we submit it again, then it is Restarted from the Last successful Checkpoint ? If some JOBSTEP is abending, what is the benifit to Restart it, WILL IT NOT ABEND AGAIN if you don't change the LOGIC ?

1 Answers   IBM,


What do we mean by 'Virtual storage' for a dataset and for a JOBSTEP ? What is the significance of the following statement for a programmer 'Virtual storage results in program addresses being independent of the addresses that actually exist in a computer' ?

0 Answers  


what are JCLLIB and STEPLIB in JCL?

0 Answers  


What is the parameter to be passed in the job card for the unlimited time , irrespective of the job class ?

2 Answers   IBM,


Categories