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 |
What is comp-1 and comp-2?
What COBOL construct is the COBOL II EVALUATE meant to replace?
file status 00 is checked after opening the file or reading the file
Why occurs can not be used in 01 level ?
Hi Guys, I have faced one interview question if I have requirement to add 5 new columns to existing table what are prerequisite do i need to take.
Write a program that uses move corresponding.
Explain call by context by comparing it to other calls.
how many bytes do SPPPP999 will store?
How can we find out wether to declare the data items like Integer, Char,Comp? If comp types how can we decide wether it is Comp and Comp3.How it is? Please Explain... Cheers.
01 b pic +9(4) How many bytes it will take for storage???
i Want All cobol ERROR codes?
WHY LRECL NEEDS TO BE 4 EXTRA THEN THE COBOL FILE LENGTH & WHAT IT CONTAIN IN THAT LENGTH