使用子程序把输入文件的6位日期转换成8位日期。

编译和运行的JCL,JCL没经过测试。要是跑不通就留言。有人问就手写的

//KOKHEL1 JOB CLASS=A,MSGCLASS=H,MSGLEVEL=(1,1),                        
//             NOTIFY=&SYSUID                                           
//STEP010  EXEC PROC=IGYWCL                                             
//COBOL.SYSIN DD DSN=KOK.COBOL.LIB(TESTSUB),DISP=SHR                     
//LKED.SYSLMOD DD DSN=KOK.LOAD.LIB(TESTSUB),DISP=SHR 
  NAME TESTSUB(R)
//STEP020  EXEC PROC=IGYWCL                                             
//COBOL.SYSIN DD DSN=KOK.COBOL.LIB(TESTMAIN),DISP=SHR                     
//LKED.SYSLMOD DD DSN=KOK.LOAD.LIB(TESTMAIN),DISP=SHR 
  INCLUDE SYSLMOD(TESTSUB)
   NAME TESTMAIN(R) 
//TEST030  EXEC PGM=TESTMAIN                                 
//STEPLIB  DD DSN=KOK.LOAD.LIB,DISP=SHR                
//TESTFA  DD DSN=KOK.PS.TESTFA,DISP=SHR              
//TESTFC  DD DSN=KOK.PS.TESTFC,DISP=SHR              
//SYSPRINT DD SYSOUT=*                                       
//CEEDUMP  DD SYSOUT=*                                       
//SYSDUMP  DD SYSOUT=*                                       
//

主程序:

****** ***************************** Top of Data ******************************
000100 000100   PROCESS TEST,MAP                                               
008900 008900******************************************************************
009000 009000*  IDENTIFICATION DIVISION                                        
009100 009100******************************************************************
009101 009101 IDENTIFICATION                  DIVISION.                        
009102 009102 PROGRAM-ID.                     TESTMAIN.                        
009103 009103******************************************************************
009104 009104*  ENVIRONMENT    DIVISION                                        
009105 009105******************************************************************
009106 009106 ENVIRONMENT                     DIVISION.                        
009107 009107 CONFIGURATION                   SECTION.                         
009108 009108 INPUT-OUTPUT                    SECTION.                         
009109 009109 FILE-CONTROL.                                                    
009110 009110     SELECT  FILEA  ASSIGN       TO TESTFA.                       
009111 009111     SELECT  FILEC  ASSIGN       TO TESTFC.                       
009112 009112******************************************************************
009113 009113*  DATA           DIVISION                                        
009114 009114******************************************************************
009115 009115 DATA                            DIVISION.                        
009116 009116 FILE                            SECTION.                         
009117 009117 FD FILEA                                                         
009118 009118     BLOCK   CONTAINS    0   RECORDS                              
009119 009119     LABEL   RECORD      IS  STANDARD                             
009120 009120     RECORDING MODE F.                                            
009121 009121 01 FA-REC.                                                       
009122 009122    05 FA-INFO.                                                   
009123 009123       07 FA-NAME                PIC X(09).                       
009124 009124       07 FILLER                 PIC X(01).                       
009125 009125       07 FA-DATA                PIC 9(06).                       
009126 009126       07 FILLER                 PIC X(24).                       
009127 009127*                                                                 
009128 009128 FD FILEC                                                         
009129 009129     BLOCK   CONTAINS    0   RECORDS                              
009130 009130     LABEL   RECORD      IS  STANDARD                             
009131 009131     RECORDING MODE F.                                            
009132 009132 01 FC-REC.                                                       
009133 009133    05 FC-INFO.                                                   
009140 009140       07 FC-NAME                PIC X(09).                       
009150 009150       07 FILLER                 PIC X(01).                       
009160 009160       07 FC-DATA                PIC 9(08).                       
009161 009161       07 FILLER                 PIC X(24).                       
009162 009162*                                                                 
009163 009163******************************************************************
009164 009164*  WORKING-STORAGE SECTION                                        
009165 009165******************************************************************
009166 009166 WORKING-STORAGE                 SECTION.                         
009167 009167 01 WK-SWITCH                    PIC X(01).                       
009168 009168    88 WK-SWH-ON                 VALUE '1'.                       
009169 009169    88 WK-SWH-OFF                VALUE '0'.                       
009170 009170 01 WK-COUNT.                                                     
009171 009171    05 WK-CNT-RD                 PIC 9(03).                       
009172 009172    05 WK-CNT-WT                 PIC 9(03).                       
009177 009177 01 WK-DATA-IN.                                                   
009178 009178    05  WK-YEAR-IN               PIC 9(02).                       
009179 009179    05  WK-MOUTH-IN              PIC 9(02).                       
009180 009180    05  WK-DAY-IN                PIC 9(02).                       
009181 009181 01 WK-DATA-OUT.                                                  
009182 009182    05  WK-YEAR-OUT              PIC 9(04).                       
009183 009183    05  WK-MOUTH-OUT             PIC 9(02).                       
009184 009184    05  WK-DAY-OUT               PIC 9(02).                       
009185 009185******************************************************************
009186 009186*  PROCEDURE      DIVISION                                        
009187 009187******************************************************************
009188 009188 PROCEDURE                       DIVISION.                        
009191 009191 MAIN                            SECTION.                         
009192 009192 MAIN-S.                                                          
009193 009193     PERFORM  1000-INIT.                                          
009194 009194     PERFORM  2000-MAIN.                                          
009195 009195     PERFORM  3000-END.                                           
009196 009196     STOP RUN.                                                    
009197 009197 MAIN-E.                                                          
009198 009198     EXIT.                                                        
009199 009199******************************************************************
009200 009200*  1000-INIT                                                      
009201 009201******************************************************************
009202 009202 1000-INIT                       SECTION.                         
009203 009203 1000-INIT-S.                                                     
009204 009204     INITIALIZE  WK-SWITCH , WK-COUNT , WK-DATA-IN , WK-DATA-OUT. 
009205 009205     OPEN INPUT  FILEA.                                           
009206 009206     OPEN OUTPUT FILEC.                                           
009207 009207 1000-INIT-E.                                                     
009208 009208     EXIT.                                                        
009209 009209******************************************************************
009210 009210*  2000-MAIN                                                      
009211 009211******************************************************************
009212 009212 2000-MAIN                       SECTION.                         
009213 009213 2000-MAIN-S.                                                     
009214 009214     ADD   +1                    TO WK-CNT-RD.                    
009215 009215     READ FILEA                                                   
009216 009216       AT END                                                     
009217 009217         SET   WK-SWH-ON         TO TRUE                          
009218 009218       NOT AT END                                                 
009219 009219         MOVE  FA-NAME           TO FC-NAME                       
009220 009220         MOVE  FA-DATA           TO WK-DATA-IN                    
009221 009221         CALL  'TESTSUB'         USING WK-DATA-IN , WK-DATA-OUT   
009222 009222         MOVE  WK-DATA-OUT       TO FC-DATA                       
009223 009223         WRITE FC-REC                                             
009224 009224         ADD   +1                TO WK-CNT-WT                     
009225 009225     END-READ.                                                    
009230 009230*                                                                 
020700 020700     PERFORM  UNTIL WK-SWH-ON                                     
020710 020710       ADD  +1                   TO WK-CNT-RD                     
020800 020800       READ FILEA                                                 
020900 020900         AT END                                                   
020910 020910           SET   WK-SWH-ON       TO TRUE                          
021000 021000         NOT AT END                                               
021001 021001           MOVE  FA-NAME         TO FC-NAME                       
021002 021002           MOVE  FA-DATA         TO WK-DATA-IN                    
021003 021003           CALL  'TESTSUB'       USING WK-DATA-IN , WK-DATA-OUT   
021004 021004           MOVE  WK-DATA-OUT     TO FC-DATA                       
021020 021020           WRITE FC-REC                                           
021030 021030           ADD   +1              TO WK-CNT-WT                     
021100 021100       END-READ                                                   
021200 021200     END-PERFORM.                                                 
021300 021300 2000-MAIN-E.                                                     
021400 021400     EXIT.                                                        
023300 023300******************************************************************
023400 023400* 3000-END                                                        
023500 023500******************************************************************
023600 023600 3000-END                        SECTION.                         
023601 023601 3000-END-S.                                                      
023603 023603     DISPLAY 'READ : ' , WK-CNT-RD.                               
023605 023605     DISPLAY 'WRITE: ' , WK-CNT-WT.                               
023607 023607     CLOSE FILEA , FILEC.                                         
023609 023609 3000-END-E.                                                      
023610 023610     EXIT.                                                        
****** **************************** Bottom of Data ****************************

子程序

****** ***************************** Top of Data ******************************
000001 000100   PROCESS TEST,MAP                                               
000002 008900******************************************************************
000003 009000*  IDENTIFICATION DIVISION                                        
000004 009100******************************************************************
000005 009101 IDENTIFICATION                  DIVISION.                        
000006 009102 PROGRAM-ID.                     TESTSUB.                         
000007 009103******************************************************************
000008 009104*  ENVIRONMENT    DIVISION                                        
000009 009105******************************************************************
000010 009106 ENVIRONMENT                     DIVISION.                        
000011 009107 CONFIGURATION                   SECTION.                         
000012 009112******************************************************************
000013 009113*  DATA           DIVISION                                        
000014 009114******************************************************************
000015 009115 DATA                            DIVISION.                        
000016 009166 WORKING-STORAGE                 SECTION.                         
000017 009181 01 WK-DATA-OUT.                                                  
000018 009182    05  WK-YEAR-OUT.                                              
000019 009183        07 WK-YEAR-OUT1          PIC 9(02).                       
000020 009184        07 WK-YEAR-OUT2          PIC 9(02).                       
000021 009185    05  WK-MOUTH-OUT             PIC 9(02).                       
000022 009186    05  WK-DAY-OUT               PIC 9(02).                       
000023 009187******************************************************************
000024 009188*  LINKAGE SECTION                                                
000025 009189******************************************************************
000026 009190 LINKAGE                         SECTION.                         
000027 009191 01 LK-DATA-IN.                                                   
000028 009192    05  LK-YEAR-IN               PIC 9(02).                       
000029 009193    05  LK-MOUTH-IN              PIC 9(02).                       
000030 009194    05  LK-DAY-IN                PIC 9(02).                       
000031 009195 01 LK-DATA-OUT.                                                  
000032 009196    05  LK-YEAR-OUT              PIC 9(04).                       
000033 009197    05  LK-MOUTH-OUT             PIC 9(02).                       
000034 009198    05  LK-DAY-OUT               PIC 9(02).                       
000035 009199******************************************************************
000036 009200*  PROCEDURE      DIVISION                                        
000037 009201******************************************************************
000038 009202 PROCEDURE                       DIVISION USING LK-DATA-IN ,      
000039                                                       LK-DATA-OUT.      
000040 009203*                                                                 
000041 009204     PERFORM  1000-INIT.                                          
000042 009205     PERFORM  2000-MAIN.                                          
000043 009206     PERFORM  3000-END.                                           
000044 009207******************************************************************
000045 009208*  1000-INIT                                                      
000046 009209******************************************************************
000047 009210 1000-INIT                       SECTION.                         
000048 009211 1000-INIT-S.                                                     
000049 009212     INITIALIZE  WK-DATA-OUT.                                     
000050 009213 1000-INIT-E.                                                     
000051 009214     EXIT.                                                        
000052 009215******************************************************************
000053 009216*  2000-MAIN                                                      
000054 009217******************************************************************
000055 009218 2000-MAIN                       SECTION.                         
000056 009219 2000-MAIN-S.                                                     
000057 009220     IF  LK-YEAR-IN > 50                                          
000058 009230         MOVE  19                TO WK-YEAR-OUT1                  
000059 009240         MOVE  LK-YEAR-IN        TO WK-YEAR-OUT2                  
000060 009250     ELSE                                                         
000061 009260         MOVE  20                TO WK-YEAR-OUT1                  
000062 009270         MOVE  LK-YEAR-IN        TO WK-YEAR-OUT2                  
000063 009280     END-IF.                                                      
000064 009290     MOVE  LK-MOUTH-IN           TO WK-MOUTH-OUT.                 
000065 009300     MOVE  LK-DAY-IN             TO WK-DAY-OUT.                   
000066 009400     MOVE  WK-DATA-OUT           TO LK-DATA-OUT.                  
000067 021300 2000-MAIN-E.                                                     
000068 021400     EXIT.                                                        
000069 023300******************************************************************
000070 023400* 3000-END                                                        
000071 023500******************************************************************
000072 023600 3000-END                        SECTION.                         
000073 023601 3000-END-S.                                                      
000074 023608     GOBACK.                                                      
000075 023609 3000-END-E.                                                      
000076 023610     EXIT.                                                        
****** **************************** Bottom of Data ****************************

input data set:

****** ***************************** Top of Data ******************************
000001 AAAAAAAAA 981110                                                        
000002 BBBBBBBBB 961110                                                        
000003 CCCCCCCCC 081010                                                        
000004 DDDDDDDDD 020202                                                        
000005 EEEEEEEEE 860520                                                        
000006 FFFFDDDDD 001111                                                        
****** **************************** Bottom of Data ****************************

output data set:

****** ***************************** Top of Data ******************************
000001 AAAAAAAAA 19981110                                                      
000002 BBBBBBBBB 19961110                                                      
000003 CCCCCCCCC 20081010                                                      
000004 DDDDDDDDD 20020202                                                      
000005 EEEEEEEEE 19860520                                                      
000006 FFFFDDDDD 20001111                                                      
****** **************************** Bottom of Data ****************************
Copyright © OneZos all right reserved,powered by Gitbook本书发布时间: 2021-06-09 10:56:06

results matching ""

    No results matching ""