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 is the use of intialize verb?
What is an in line perform? When would you use it? Anything else you wish to say about it.
Write a program to enter and display the names of students in a class using the occurs clause.
) How do u handle errors in BMS macro?
How you can characterize tables in cobol?
Difference between cobol and cobol-ii?
How many bytes S(8) comp field occupy and its maximum value?
Which mode is used to operate the sequential file?
What are the rules of the move verb?
How to read the 2nd last record of a VSAM file? (The file size is huge and we don't know the key)
What are 77 levels used for?
Why occurs cannot be used in 01 level in COBOL?
How to know whether the module is dynamical or statistical?
What is rmode(24)
What are INPUT PROCEDURE and OUTPUT PROCEDURE?