PS TO KSDS CLUSTER (WRITE)


***** PS TO KSDS CLUSTER (WRITE) *****

 IDENTIFICATION DIVISION.           
 PROGRAM-ID. MEM3.                  
 ENVIRONMENT DIVISION.              
 INPUT-OUTPUT SECTION.              
 FILE-CONTROL.                      
         SELECT PSFILE ASSIGN TO DD1.   
         SELECT KSDSFILE ASSIGN TO DD2  
         ORGANIZATION IS INDEXED        
         RECORD KEY IS KS-EC            
         FILE STATUS IS FS1.            
 DATA DIVISION.                     
 FILE SECTION.                      
 FD PSFILE.                         
 01 PSREC.                          
   02 PS-EC PIC 9(4).               
   02 PS-EN PIC X(4).               
   02 FILLER PIC X(72).             
FD KSDSFILE.                                       
01 KSDSREC.                                        
  02 KS-EC PIC 9(4).                               
  02 KS-EN PIC X(4).                               
  02 FILLER PIC X(72).                             
WORKING-STORAGE SECTION.                           
77 FS1 PIC X(2).                                   
PROCEDURE DIVISION.                                
          OPEN INPUT PSFILE.                              
          OPEN OUTPUT KSDSFILE.                          
          PERFORM READ-PARA.                             
READ-PARA.                                         
          READ PSFILE AT END CLOSE PSFILE, KSDSFILE      
          STOP RUN.                                      
         MOVE PSREC TO KSDSREC.                         
         WRITE KSDSREC.                                 
         DISPLAY KSDSREC.                            
         GO TO READ-PARA.                    


File Program's in COBOL:                          
  1. PS TO RRDS CLUSTER (WRITING)
  2. PS TO KSDS CLUSTER (WRITE) 
  3. RUNJCL TO RRDS (WRITE) 
  4. RUNJCL TO RRDS (WRITE) 
  5. RUNJCL TO KSDS CLUSTER(WRITE) 
  6. FETCH A RECORD BY USING RANDOM IN RRDS CLUSTER 
  7. FETCH A RECORD BY USING RANDOM IN KSDS CLUSTER
  8. FETCHING RECORDS BY USING DYNAMIC IN RRDS CLUSTER
  9. FETCH RECORDS BY USIING DYNAMIC IN KSDS CLUSTER 
  10. INSERT A RECORD IN RRDS CLUSTER
  11. INSERT A RECORD IN KSDS CLUSTER 
  12. REWRITE A RECORD IN RRDS CLUSTER 
  13. REWRITE A RECORD IN KSDS CLUSTER
  14. DELETE A RECORD IN RRDS CLUSTER   
  

1 comments:

Amit Sharma said...

Hi,
How about addidng a logic to keep a check on duplicate records?

Computers TopOfBlogs Technology Blogs Mainframe interview question and answers,mainframe jobs,cobol,vsam,jcl,cics,db2,rdbms,mvs,tso,ispf,ibm,hcl,tcs,cts,wibro Blog Directory