FALSE

Page Nav

HIDE

Grid

GRID_STYLE

Sort Programe Using COBOL

Program Code : 000001         IDENTIFICATION DIVISION.               000002         PROGRAM-ID. S1.                        000003        ...


Program Code :
000001        IDENTIFICATION DIVISION.             
000002        PROGRAM-ID. S1.                      
000003        ENVIRONMENT DIVISION.                
000004        INPUT-OUTPUT SECTION.                
000005        FILE-CONTROL.                         
000006               SELECT INFILE ASSIGN TO DD1.  
000007               SELECT WORKFILE ASSIGN TO DD2.
000008               SELECT OUTFILE ASSIGN TO DD3. 
000009        DATA DIVISION.                       
000010        FILE SECTION.                        
000011        FD INFILE.                           
000012        01 INREC.                            
000013              02 NAMES PIC A(20).            
000014              02 F PIC X(60).                
000015        SD WORKFILE.                         
000016        01 WKREC.                            
000017              02 WNAME PIC A(20).            
000018              02 F PIC X(60).                          
000019        FD OUTFILE.                                     
000020        01 OUTREC.                                     
000021             02 ONAME PIC A(20).                       
000022             02 F PIC X(60).                           
000023        WORKING-STORAGE SECTION.                        
000024        PROCEDURE DIVISION.                            
000025        P1.                                            
000026                 SORT WORKFILE  ON ASCENDING KEY WNAME 
000027                 USING INFILE GIVING OUTFILE.           
000028                 STOP RUN.                             


Compile Code :

000001 //OZA030A JOB MSGLEVEL(1,1),NOTIFY=&SYSUID                 
000002 //JOBPROC JCLLIB ORDER=OZASUP.SUP.PROCLIB                  
000003 //COBCL   EXEC COBCL                                        
000004 //COMPILE.SYSIN    DD  DSN=OZA030.DIV.PDS(FISO),DISP=SHR   
000005 //*COMPILE.SYSLIB  DD  DSN=OZA030.ADMN.COPYLIB,DISP=SHR    
000006 //LKED.SYSLMOD     DD  DSN=OZA030.COBOL.LOAD(FISO),DISP=SHR

Run Code :

000001 //OZA030A  JOB MSGLEVEL=(1,1),NOTIFY=OZA030,TIME=(2,1)  
000002 //COBCL  EXEC PGM=FISO                                  
000003 //STEPLIB DD DSN=OZA030.COBOL.LOAD,DISP=SHR             
000004 //SYSOUT DD SYSOUT=*                                     
000005 //SYSPRINT DD SYSOUT=*                                  
000006 //DD1     DD DSN=OZA030.S1.PS,DISP=SHR                  
000007 //DD2     DD DSN=OZA030.S3.PS,DISP=SHR                  
000008 //DD3     DD DSN=OZA030.S2.PS,DISP=SHR                   
000009 //SYSIN DD *                                            
000010 /*                                                      
000011 //      

Input  In  OZA030.S2.PS :          

000001 DIVYA   
000002 DEEPAK  
000003 ARAVIND 
000004 YAMINI  
000005 BAVI    

Output  In  OZA030.S2.PS :          

000001 ARAVIND 
000002 BAVI    
000003 DEEPAK  
000004 DIVYA   
000005 YAMINI                             

No comments