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 are all the divisions of a COBOL program?
)If there are 10 steps in GDG, if I want to refer the step2 after step5 . what should I do?
can anybody post me about file-aid and changemen tools pls and give me reference if any mainframe guys are there
I have File 1 occurs 5 times with Employee-ID,Employee-Name,Employee-Dept (EEE and MECH). I have File 2 occurs 10 times with Employee-ID,Employee-Name,Employee-Dept (EEE,CIVIL,CHEMICAL and MECH). In FIle 1 and FIle 2 , for matching Employee-DEPT (Only MECH) , we need to move entire records from file1 to file 2. We should not use 2D array. Your help is needed here.
I have one ps file in which there are 3 fileds emp_no,emp_name and leave_app.this ps file information give the detail of employee which is going to apply for leave.suppose emp_no=113430,emp_name=ajay,leave_app=1 that means he is going to apply for 1 day leave.and accordingling the table in db2 will be updated means if he has that no of leave in his account then he will get dat leave and updated acc. in table(leave_balance=previous leave present in table-leave_app).Now i want to check whther the updated result is correct or not by comparing the two ps file using IEBCOMPARE or icetool so what is going to be the two ps file and how its is going to be compare.
How do u write test cases?
What is the compute verb? How is it used?
Which mode is used to operate the sequential file?
What is the utilization of copybook in cobol?
what are decleratives in cobol?
How do you reference the following file formats from cobol programs?
What is amode(31)
What the difference is between continue and next sentence?
input= ,,,, mainframe training ,,, hyderabad .... location.... output1=$ mainframe training in hyderabad location$ output2=**** mainframe training in hyderabad location ****. In this pgn when we give input considering the spaces the output is displayed in this format.Like in the place of ,,,, $ should be displayed likewise.So please helpmeout.
how do you reference the variable block file formats from cobol programs