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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

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

649


I have a job called careerride and some steps in it as step1,step2. But I want to execute step2 before step1 ? How do I do that?

825


We can use PASS with permanent datasets also. THEN Which is the condition in which we may use PASS (instead of KEEP) with permanent data sets, while there is no need to specify UNIT and VOL for them like temporary data sets (in cas we use KEEP for permanent data sets) ?

1765


what happens in conversion stage in job processing?

728


Explain the function of dd disp parameter?

593






How can a fb file convert to vb file using sort program?

802


What is the purpose of dd * statement in jcl?

796


I want to JCL sort for Non-COMP and COMP-3 fields SORT FIELDS=(1,5,A,6,11,A,12,11,A,19,1,A,20,1,A),FORMAT=BI,EQUALS Length of comp bytes is 11 bytes which start at 6byte and 12 byte considering 11 bytes in comp-3 is 6 bytes. Can anyone tell if the above sort work SORT FIELDS=(1,5,A,6,6,A,12,6,A,19,1,A,20,1,A),FORMAT=BI,EQUALS does not works OK

1485


Explain how can a stopped job be started again?

636


Matching Logic in Jcl not in cobol.Could any one please answer this question

3669


What is catelog procedure and how many catelog procedure to use in one job?

7438


how do you code a null statement?

773


WORKING-STORAGE SECTION. 77 W-A PIC 9(3)V99 VALUE 23.75. 77 W-B PIC ZZ9V99 VALUE 123.45. PROCEDURE DIVISION. MOVE W-A TO W-B. DISPLAY W-B. STOP RUN. compiler : IGYGR1080-S A "VALUE" clause literal was not compatible with the data category o subject data item. The "VALUE" clause was discarded. WORKING-STORAGE SECTION. 77 W-A PIC 9(3)V99 VALUE 23.75. 77 W-B PIC ZZ9V99. PROCEDURE DIVISION. MOVE 123.45 TO W-B. MOVE W-A TO W-B. DISPLAY W-B. STOP RUN. 2375

1035


what is the purpose of coding class parameter in job statement?

716


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

705