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


Please Help Members By Posting Answers For Below Questions

What is the use of intialize verb?

738


What is an in line perform? When would you use it? Anything else you wish to say about it.

639


Write a program to enter and display the names of students in a class using the occurs clause.

642


) How do u handle errors in BMS macro?

1418


How you can characterize tables in cobol?

708






Difference between cobol and cobol-ii?

697


How many bytes S(8) comp field occupy and its maximum value?

1621


Which mode is used to operate the sequential file?

654


What are the rules of the move verb?

695


How to read the 2nd last record of a VSAM file? (The file size is huge and we don't know the key)

2716


What are 77 levels used for?

650


Why occurs cannot be used in 01 level in COBOL?

707


How to know whether the module is dynamical or statistical?

648


What is rmode(24)

673


What are INPUT PROCEDURE and OUTPUT PROCEDURE?

679