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?
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 |
At the minimum, which division of COBOL is enough to be coded?
What are the different open modes available in cobol?
Suppose, file A has 100 records and file B has 500 records. We want to write records common to both A and B into file C and records which are present only in either A or B into another file D. What should be the logic of Cobol program to achieve this?
7 Answers Bank Of America, Mind Tree,
example for sub strings ? and refernce modifications whit output pls
0 Answers College School Exams Tests, IBM,
what is srange and nosrange pls reply to ths question ?
how many divisions are there in cobol
What is difference between com and com3? Eg. s9(4) so what is the memory it will occupy com and com3.
what r the types of perform statement
How to remove the spaces at end of each record in the output file Via COBOL program? note: The file has a VB length
I want to declare a field with data type Double in my COBOL program. how shall i do that ?
What is Pic 9v99 Indicates in COBOL?
0 Answers SwanSoft Technologies,
What divisions, sections and paragraphs are mandatory for a COBOL program?