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
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 |
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 |
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 |
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 |
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 |
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 |
What will happen if we write two STOP RUN's in a COBOL program?
Max. No of DD statements in a job ?
1)what is compilation jcl for cobol program but it is calling another program 2)what is compilation jcl for cobol program but it is calling another program(in this, main program is pure cobol but sub program is cobol+db2 program.can anyone please answer me for above questions. it's very urgent
How to view the hexa decimal value thru file aid if copy book is not present for that particular data
How many steps we can overide in the proc's?
Does the terms, JOBLOG, SPOOL and SYSOUT indicate the same thing, i.e., where JCL and JES messages and statements are written ?
what is mainframe?
Can we find specific member without knowing the name of PDS or can we search a member to which PDS it belongs to? if so how?
Name the system library from which modules are retrieved at execution
How many types we can give input to JCL
Could you provide an example and its effect OF, Using COND on JOB and EXEC both ?
Can we change a FB file to VB file in JCL? Please help