FALSE

Page Nav

HIDE

Grid

GRID_STYLE

FETCH A RECORD BY USING RANDOM IN KSDS CLUSTER

***** FETCH A RECORD BY USING RANDOM IN KSDS CLUSTER *****  IDENTIFICATION DIVISION.          PROGRAM-ID...


***** FETCH A RECORD BY USING RANDOM IN KSDS CLUSTER *****

 IDENTIFICATION DIVISION.        
 PROGRAM-ID. SEARCHR.            
 ENVIRONMENT DIVISION.           
 INPUT-OUTPUT SECTION.           
 FILE-CONTROL.                   
     SELECT IN-FILE ASSIGN TO DD1
     ORGANIZATION IS INDEXED     
     ACCESS MODE IS RANDOM       
     RECORD KEY IS ENO           
     FILE STATUS IS FS1.         
 DATA DIVISION.                  
 FILE SECTION.                   
 FD IN-FILE.                     
 01 IN-REC.                      
   02 ENO PIC 9(4).              
   02 ENAME PIC X(4).             
   02 SAL PIC 9(5).              
       02 FILLER PIC X(67).                 
 WORKING-STORAGE SECTION.               
  77 FS1 PIC 9(2).                       
  77 REL-KEY PIC 9(4).                   
  01 IN-REC1.                             
    03 ENO1 PIC 9(4).                    
    03 ENAME1 PIC X(4).                  
    03 SAL1 PIC 9(5).                    
    03 FILLER PIC X(67).                 
  PROCEDURE DIVISION.                    
             PERFORM OPEN-PARA.                  
             PERFORM SEARCH-PARA.               
             PERFORM CLOSE-PARA.                
  OPEN-PARA.                             
            OPEN INPUT IN-FILE.                
            MOVE 0003 TO ENO.                  
  SEARCH-PARA.                           
                 READ IN-FILE RECORD INTO IN-REC1   
                 IF ENO = ENO1            
                 MOVE ENO1 TO ENO         
                 MOVE ENAME TO ENAME1     
                 MOVE SAL TO SAL1         
                 DISPLAY IN-REC1          
                 ELSE                     
                 COMPUTE ENO = ENO + 1    
                 GO TO SEARCH-PARA.       
 CLOSE-PARA.                  
             CLOSE IN-FILE.            

No comments