How do u sort the table for Search ALL? Is it only using
ASCENDING KEY IS statement in occurs clause? If the data is
input in non ascending order, will the ASC KEY IS
automatically sort the data? or will it throw compile time
error?
Answer Posted / snehatechm
for using SEARCH ALL your table must be defined with KEY IS
along with the OCCURS caluse and INDEXED BY.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 XXX-TABLE.
03 XXX-TEXT PIC X OCCURS 10 TIMES
ASCENDING KEY IS XXX-TEXT
INDEXED BY AXIDX.
In the above case my table is ordered in ascending sequence.
i can order my table in descending sequence also.
01 SRCHXXX PIC X.
01 XXXPOS PIC 99.
PROCEDURE DIVISION.
Begin.
ACCEPT SRCHXXX
SET AXIDX TO 1
SEARCH ALL XXX-TEXT
AT END DISPLAY "NO LETTER FOUND"
WHEN XXX-TEXT(AXIDX) = SRCHXXX
SET XXXPOS TO AXIDX
DISPLAY SRCHXX " IS IN " XXXPOS
END-SEARCH
STOP RUN.
If data input in non ascending order, the ASC KEY will not
automatically sort the data
| Is This Answer Correct ? | 10 Yes | 0 No |
Post New Answer View All Answers
What are declaratives and what are their uses in cobol?
what is s000 u4087 error? please give the all error codes in cobol,jcl.
What are the different rules for performing sort operation?
What is the difference between Call and a Link?
What is rmode(any) ?
What are the various section in data division and briefly explain them.
Define static linking and dynamic linking.
Name some of the examples of COBOl 11?
How can i load all the data from a file to Table (array) in cobol.How i manage the occurs clause with out reading the file.Any options avilable ? Please can any one help me it is urgent?
1.give the details about WHEN OTHER. 2. how many form are available in evaluate.
Write a program that uses move corresponding.
Discuss about changing dataset name in proc.
What is the difference between PIC 9.99 and PIC9v99?
A table has two indexes defined. Which one will be used by the SEARCH?
What are the different data types in cobol?