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)???

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

i want to store 20 digits . how will u do it in cobol ?

858


How does jcl act on code(if you take a cobol program)?

705


How to compare two files in SYNCSORT and on the mismatch record should be deleted from second file.

5059


Explain the purpose of dd dummy statement?

669


What do you understand by the term “keyword” with respect to jcl and what is the opposite of the term?

674






a dd statement has 2 types of parameters. Name them?

644


Is there any command to check wether the ps file is in sorted order?

2428


Suppose I have a program in cobol name ”careerride” and want to execute the program by jcl. Specify the process?

668


what is SOC4 error?

734


Name the parameters which can be used to limit the number of records written to a sysout dataset?

649


What is the use of symbol // in jcl?

918


How can the attributes of one sms dataset be copied to another dataset?

848


What is the function of dd disp parameter?

654


How dummy is used in jcl?

643


What is Cataloged Procedures?

711