Master File and Screen 2
Master File and Screen 2
Master File and Screen 2
COMP1: Whatever value you give it will take 4 bytes, so Can't use PIC clause. If anyone gives more than 4 number that
will be syntax problem.
COMP2: Whatever value you give it will take 8 bytes, so Can't use PIC clause. If anyone gives more than 8 number that
will be syntax problem.
COMP3: PIC S9(n) COMP-3 VALUE 12. (N/2) +1 & (N+1)/2
01 WS-TABLE2D. 01 WS-TABLE2D.
05 WS-A OCCURS 3 TIMES. 05 WS-A OCCURS 3 TIMES INDEXED BY I.
10 WS- A1 PIC X(1). 10 WS-A1 PIC X(1).
10 WS-B OCCURS 2 TIMES. 10 WS-B OCCURS 2 TIMES INDEXED BY J.
15 WS-B1 PIC X(1). 15 WS-B1 PIC X(1).
PROCEDURE DIVISION.
PROCEDURE DIVISION. MOVE 'A12B34C56' TO WS-TABLE2D.
MOVE 'A12B34C56' TO WS-TABLE2D. PERFORM PARA-A VARRYING I FROM 1 BY 1 UNTIL I>3.
SET I J TO 1.
'A' will go to the 1st Occurrence of WS-A1 (1) PERFORM PARA-C.
'1' will go to the 1st Occurrence of WS-B1 (1,1) --> this is STOP RUN.
SUBCRIPT Method to find a data. PARA-A.
DISPLAY WS-A(I).
PERFORM PARA-B VARRYING J FROM 1 BY 1 UNTIL J>2.
PARA-B.
DISPLAY WS-B(I,J).
SEARCH WS-A.
AT END DISPLAY 'C IS NOT FOUND'.
WHEN WS-A(I) = 'C'.
DISPLAY 'C IS FOUND'.
END-SEARCH.