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
) how do u code after getting data?
explain sorting techniques in cobol program?
What is the Purpose of Pointer in the string?
I have to write to a outfile where the number of records in that file should be the header of that file using IMS.. can anyone help me in this issue
There are 5 fields and 1000 records in a file. Unload it into an array. Write the syntax for declaration and how will you unload it.
How to print 10 to 1 if the input have only 10 digit number?
if we have " ibm mainframe ",in that how to remove first and last leading space eg:"ibm mainframe" like that the answer we need
What is report-item in COBOL?
how do you reference the rrds file formats from cobol programs
What happens when we move a comp-3 field to an edited (say z (9). Zz-)?
What is the default value(s) for an initialize and what keyword allows for an override of the default?
How to read the 2nd last record of a VSAM file? (The file size is huge and we don't know the key)
What is comp-1 and comp-2?
Name the divisions, which are available in a cobol program?
What are the different rules for performing sort operation?