Outline IBM 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 O What is the Year 2000 problem? O What does "Year 2000 ready" mean? O Year 2000-ready products O How to solve the Year 2000 problem O Y2K conversion and language migration O How to make your applications Y2K ready O DFSORT and the century window O COBOL program samples O Testing your applications O Look out! O How to get more information 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 GUIDE Fall 1996 AP850 IBM COBOL 1 What is the Year 2000 problem? IBM 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 * Date information stored with only 2 digits * Incorrect century - 04 assumed to be 1904 * Arithmetic calculation - A person born in 1950 calculated to be -50 years old - Due date of 30 year mortgage started in 1990 could be calculated to be 1920, paid off! * Sequence - 12/31/99 comes after 01/01/00 - IMS database updates will fail without V5 and fix * Leap Year - If divisible by 100, then not a leap year, right? - Except 2000 is a leap year 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 GUIDE Fall 1996 AP850 IBM COBOL 2 What is the Year 2000 problem? IBM 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 旼컴컴컴컴컴컴컴컴컴컴컴컴컴� | | | | | | | | | | | | | | | | | | | For non-application code: | 읕컴컴컴컴컴컴컴컴컴컴컴컴컴| | | | | | | | | 컴컴컴컴컴컴컴컴컴컴컴컴컴컴| O Archiving and deleting of old datasets * They might not be old on Jan 1 2000! O Conventions of '99365' meaning keep forever * That date is only 3 years and 40 days away O Expiration dates on tape labels O Homemade dataset managers O Any and all system software that has not solved the problem 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 GUIDE Fall 1996 AP850 IBM COBOL 3 What does "Year 2000 ready" mean? IBM 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 旼컴컴컴컴컴컴컴컴컴컴컴컴� | | | | | | | | | | | | | | | | | | | Year 2000 ready Product | 읕컴컴컴컴컴컴컴컴컴컴컴컴| | | | | | | | | 컴컴컴컴컴컴컴컴컴컴컴컴컴| The Product, when used in accordance with its associated documentation, is capable of correctly processing, providing and/or receiving date data within and between the twentieth and twenty-first centuries, provided that all products (for example, hardware, software and firmware) used with the Product properly exchange accurate date data with it. O This can be applied to your applications as well O More simply, ask yourself: -> Will your applications run after 1999? -> Will they produce the correct output after 1999? 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 GUIDE Fall 1996 AP850 IBM COBOL 4 Year 2000-ready products IBM 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 -> See the supplied book, GC28-1251 -> Make sure that your hardware is ready -> Make sure that your system software is ready -> Examples: O CICS V3.3 or earlier will not run across midnight 12/31/1999 * Might be able to do a complete ice-cold rebuild/restart for V3.3 O IMS V4 and earlier will fail the first database update of 2000 * 2-digit year dates in IMS Log records * IMS V5 with maintenance uses century window O OS/VS COBOL and VS COBOL II are NOT Year 2000 ready 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 GUIDE Fall 1996 AP850 IBM COBOL 5 Year 2000-ready products IBM 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 -> Languages are a whole different animal * Non-ready System Software will fail regardless of your applications -> We know of no problems with IBM languages running after 1999 * For COBOL, only COBOL for MVS & VM and Language Environment are ready -> They will run, but old languages only give you a 2-digit year date! * NO 4-digit year date COBOL language in: O OS/VS COBOL or O VS COBOL II -> Your applications need century window and 4-digit year date functions * With only 2-digit year dates and no window, then fail! -> Your applications need to be changed * 90% of financial applications need to be changed * 75% of other applications need to be changed 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 GUIDE Fall 1996 AP850 IBM COBOL 6 How to solve the Year 2000 problem IBM 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 1. Replace non-ready hardware 2. Replace non-ready system software 3. Fix all of your applications and data 4. Link and run applications with 旼컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴� | | | | | | | | | | | | | | | | | | | Language Environment for MVS & VM | 읕컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴| | | | | | | | | 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴| 5. Test That's it! 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 GUIDE Fall 1996 AP850 IBM COBOL 7 Y2K conversion and language migration IBM 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 * Share the same process, and most of the same steps -> Planning -> Inventory -> Ownership -> Status -> (Source conversion/Year2000 changes) -> Compile, link -> Unit Test -> System Test 旼컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴커 | | | | | | | | | | | | | | | | | | | Combine and save money and time!| 읕컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴�| | | | | | | | | 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴탠 * "Collateral Benefit" 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 GUIDE Fall 1996 AP850 IBM COBOL 8 How to make your apps Y2K ready IBM 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 1. Field expansion * The best, more later 2. Century window * Temporary, not too bad, more later * Sliding or fixed window 3. Century encoding/compression * Can't read in dumps, listings * Must translate whenever externalized * Translation could be wrong * Maintenance more difficult 4. Integer format dates * Can't read in dumps, listings * Must translate whenever externalized * Translation could be wrong 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 GUIDE Fall 1996 AP850 IBM COBOL 9 How to make your apps Y2K ready IBM 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 旼컴컴컴컴컴컴컴컴컴컴컴컴컴컴커 | | | | | | | | | | | | | | | | | | | More on integer format dates| 읕컴컴컴컴컴컴컴컴컴컴컴컴컴컴�| | | | | | | | | 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴탠 -> Provided by COBOL Intrinsic Functions and by Language Environment date/time callable services -> Number of days from some point in the past -> PRO: Use only 4 bytes to store a date -> CON: Too many Integer format starting dates: * CICS, MVS, DB2 - start with Jan 1, 1900 * PL/I - no integer date values * C - start with Jan 1, 1970 * COBOL - start with Jan 1, 1601 * LE/370 - start with Oct 15, 1582 -> Solution for COBOL: Use COBOL for MVS & VM Install option * INTDATE(LILIAN) or INTDATE(ANSI) * Use INTDATE(LILIAN) to get LE/370 Lilian dates from Intrinsic Functions 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 GUIDE Fall 1996 AP850 IBM COBOL 10 How to make your apps Y2K ready IBM 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 旼컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴� | | | | | | | | | | | | | | | | | | | Long-term solution: Field Expansion | 읕컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴| | | | | | | | | 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴| O You must eventually: ____ 1. Re-write applications * Use COBOL Intrinsic Functions to get 4-digit year dates OR * Use LE/370 callable services to get 4-digit year dates 2. AND Rebuild databases and files with 4-digit years O The above are the long-term solutions that will take you and your company through to the year 9999 O However, there is a short-term solution that is easier 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 GUIDE Fall 1996 AP850 IBM COBOL 11 How to make your apps Y2K ready IBM 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 旼컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴� | | | | | | | | | | | | | | | | | | | Short-Term solution: Century window | 읕컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴| | | | | | | | | 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴| -> Use the LE/370 century window in old applications to interpret 2-digit year dates as 4-digit year dates -> Advantages: O Fewer program changes, no database change O Cheaper, quicker, easier -> Disadvantages: O Performance will be slower with the increased logic O This only buys you a few years, depending on the application O You still MUST change all date programs and databases eventually to use 4-digit years 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 GUIDE Fall 1996 AP850 IBM COBOL 12 How to make your apps Y2K ready IBM 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 旼컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴� | | | | | | | | | | | | | | | | | | | Short-Term vs long-term: which is better? | 읕컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴| | | | | | | | | 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴| 旼컴�> � Field Expansion � M A � 旼컴컴컴컴컴컴컴컴� � A � � � � � I � � � � N C � � � � T O � � 旼컴컴컴컴커 � � E S � � � � � � N T � � � � � Century Window � A S � � � 읕냐컴컴컴컴컴컴컴켸 N � � � � C � � � � E 냐컴耗컴켸 읕컴컴컴컴컴컴컴컴컴컴> � � � 읕컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴� Time �> 1996 2000 2020 O Not only will it not work forever: * It will cost more to maintain * You will have to do it all again later! 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 GUIDE Fall 1996 AP850 IBM COBOL 13 How to make your apps Y2K ready IBM 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 旼컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴커 | | | | | | | | | | | | | | | | | | | What to do with historical data with field expansion | | method? | 읕컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴�| | | | | | | | | 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴�| -> Basically just two choices for data: * Expand all old files/databases * Keep copies of old data -> Which leads to choices for code: * Copies of old code to access the data as well or * Code needs to handle both 2-digit and 4-digit years O Could use conditional "bridges" when accessing old data 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 GUIDE Fall 1996 AP850 IBM COBOL 14 How to make your apps Y2K ready IBM 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 旼컴컴컴컴컴컴컴컴컴컴컴컴� | | | | | | | | | | | | | | | | | | | Partitions and bridging | 읕컴컴컴컴컴컴컴컴컴컴컴컴| | | | | | | | | 컴컴컴컴컴컴컴컴컴컴컴컴컴| 旼컴컴컴� 旼컴컴컴� 旼컴컴컴� � APP1 끘컴�>� APP2 �<컴컴�' DATA3 � � (YY) � � (YY) � � (YY) � 읕컴컴컴� 읕컴컴컴� 읕컴씻컴� A A A � � � � � � � � V � � 旼컴珏컴� 旼컴컴컴� 旼컴컴컴� � 읕컴컴컴컴' DATA1 끘컴컴>� APP3 끘컴>� APP4 � � � (YY) � � (YY) � � (YY) � � 읕컴컴컴� 읕컴컴컴� 읕컴컴컴� � A � 旼컴컴컴� � 읕컴컴컴컴� DATA2 '컴컴컴컴컴컴� � (YY) � 읕컴컴컴� 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 GUIDE Fall 1996 AP850 IBM COBOL 15 How to make your apps Y2K ready IBM 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 旼컴컴컴컴컴컴컴컴컴컴컴컴� | | | | | | | | | | | | | | | | | | | Partitions and bridging | 읕컴컴컴컴컴컴컴컴컴컴컴컴| | | | | | | | | 컴컴컴컴컴컴컴컴컴컴컴컴컴| 旼컴컴컴� 旼컴컴컴� 旼컴컴커 旼컴컴컴� � APP1 끘�>� APP2 냐�>� BRDG �<컴�' DATA3 � � (YYYY)� � (YYYY)� 읕컴컴켸 � (YY) � 읕컴컴컴� 읕컴컴컴� 읕컴씻컴� A A A � � � � � � � � V � � 旼컴珏컴� 旼컴컴커 旼컴컴컴� 旼컴컴컴� � 읕컴컴컴� DATA1 '컴>� BRDG �<컴훳 APP3 끘�>� APP4 � � � (YYYY)� 읕컴컴켸 � (YY) � � (YY) � 旼珏컴커 읕컴컴컴� 읕컴컴컴� 읕컴컴컴� � BRDG � A 읕컴컴켸 � A � � 旼컴컴컴� � 읕컴컴컴� DATA2 '컴컴컴컴컴컴컴컴컴컴켸 � (YY) � 읕컴컴컴� -> Only changed APP1, APP2, DATA1 -> Burn bridges after DATA or APPS changed 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 GUIDE Fall 1996 AP850 IBM COBOL 16 DFSORT and the century window IBM 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 -> Apply fix for APAR PN71337 (PTF UN90139) to DFSORT R13 -> To use the century window function in a COBOL SORT you need to tell DFSORT when your century window starts and which fields are to be sorted using the century window -> Use the following 2 control statements in JCL: 1. OPTION Y2PAST O OPTION Y2PAST=nn * Where nn=number of years back to start of window O OPTION Y2PAST=nnnn * Where nnnn=fixed window start date 2. SORT FIELDS=(n,n,Y2C,A,...) O Where Y2C, Y2Z, Y2P, and Y2D identify 2-digit year fields in character, zoned decimal, packed decimal, and decimal form -> For more information, see DFSORT documentation www.storage.ibm.com/storage/software/sort/srtmhome/htm 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 GUIDE Fall 1996 AP850 IBM COBOL 17 DFSORT and the century window IBM 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 -> The OPTION statement can be coded in the IGZSRTCD DD statement 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 //IGZSRTCD DD * OPTION Y2PAST=20 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 -> The SORT control statement must be coded in a DFSPARM DD statement -> To SORT records that start with mm/dd/yy as yyyymmdd: 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 //DFSPARM DD * SORT FIELDS=(7,2,Y2C,A, * sort C'yy' using CW 1,2,BI,A, * sort C'mm' ascending 4,2,BI,A) * sort C'dd' ascending 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 -> Other notes on SORT: * Use a local name if your installation changed the default name DFSPARM * A SORT statement can not be specified in IGZSRTCD * This will override the SORT FIELDS produced by the compiler, so you must make sure that you identify all fields that are to be sorted. * These are the ASCENDING/DESCENDING KEYS in the SORT statements in your COBOL program 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 GUIDE Fall 1996 AP850 IBM COBOL 18 COBOL program samples IBM 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 IDENTIFICATION DIVISION. PROGRAM횵D. CURDATE. ENVIRONMENT DIVISION. DATA DIVISION. WORKING훁TORAGE SECTION. 01 FILLER VALUE 'JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC'. 03 MONTH PIC XXX OCCURS 12. 01 TODAY. 03 T훊Y PIC 99. 03 T횺M PIC 99. 03 T횯D PIC 99. LINKAGE SECTION. 01 DDMONCCYY. 05 D횯D PIC XX. 05 FILLER PIC X. 05 D횺ON PIC XXX. 05 FILLER PIC X. 05 D횮C PIC XX. 05 D훊Y PIC XX. PROCEDURE DIVISION USING DDMONCCYY. ACCEPT TODAY FROM DATE. MOVE SPACES TO DDMONCCYY. MOVE T횯D TO D횯D. MOVE MONTH(T횺M) TO D횺ON. MOVE T훊Y TO D훊Y. MOVE 19 TO D횮C GOBACK. 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 GUIDE Fall 1996 AP850 IBM COBOL 19 COBOL program samples IBM 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 IDENTIFICATION DIVISION. PROGRAM횵D. CURDATE2. ENVIRONMENT DIVISION. DATA DIVISION. WORKING훁TORAGE SECTION. 01 FILLER VALUE 'JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC'. 03 MONTH PIC XXX OCCURS 12. 01 TODAY. 03 T훊YYY PIC 9999. 03 T횺M PIC 99. 03 T횯D PIC 99. LINKAGE SECTION. 01 DDMONCCYY. 05 D횯D PIC XX. 05 FILLER PIC X. 05 D횺ON PIC XXX. 05 FILLER PIC X. 05 D횮CYY PIC XXXX. PROCEDURE DIVISION USING DDMONCCYY. MOVE FUNCTION CURRENT횯ATE(1:8) TO TODAY. MOVE SPACES TO DDMONCCYY. MOVE T횯D TO D횯D. MOVE MONTH(T횺M) TO D횺ON. MOVE T훊YYY TO D횮CYY. GOBACK. 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 GUIDE Fall 1996 AP850 IBM COBOL 20 COBOL program samples IBM 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 IDENTIFICATION DIVISION. PROGRAM횵D. CURDATE3. ENVIRONMENT DIVISION. DATA DIVISION. WORKING훁TORAGE SECTION. 01 FILLER VALUE 'JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC'. 03 MONTH PIC XXX OCCURS 12. 01 TODAY. 03 T훊YYY PIC 9(4). 03 T횺M PIC 99. 03 T횯D PIC 99. 03 T횴HMISS999 PIC 9(9). 01 SECONDS COMP�2. 01 LILIAN PIC S9(9) COMP. ********************************************** * Feedback code from the callable services ********************************************** 01 FC PIC X(12). 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 GUIDE Fall 1996 AP850 IBM COBOL 21 COBOL program samples IBM 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 LINKAGE SECTION. 01 CCYYMMDD. 05 C횮CYY PIC 9(4). 05 SLASH�1 PIC X. 05 C횺M PIC 99. 05 SLASH�2 PIC X. 05 C횯D PIC 99. 01 DDMONCCYY. 05 D횯D PIC XX. 05 FILLER PIC X. 05 D횺ON PIC XXX. 05 FILLER PIC X. 05 D횮CYY PIC X(4). PROCEDURE DIVISION USING CCYYMMDD DDMONCCYY. CALL 'CEELOCT' USING LILIAN, SECONDS, TODAY, FC. MOVE SPACES TO DDMONCCYY. MOVE T횯D TO C횯D D횯D. MOVE T횺M TO C횺M. MOVE MONTH(T횺M) TO D횺ON. MOVE T훊YYY TO C횮CYY D횮CYY. MOVE '/' TO SLASH�1 SLASH�2. GOBACK. 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 GUIDE Fall 1996 AP850 IBM COBOL 22 COBOL example MAIN IBM 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 ID DIVISION. PROGRAM횵D. MAIN. ENVIRONMENT DIVISION. CONFIGURATION SECTION. INPUT횽UTPUT SECTION. FILE횮ONTROL. SELECT RUNDATA ASSIGN TO SYSIN훁횲ILE1DD FILE STATUS IS RUNDATA횲S. DATA DIVISION. FILE SECTION. FD RUNDATA. 01 WORK훀ECORD. 03 CUST횼AME. 05 FIRST횼AME PIC X(10). 05 LAST횼AME PIC X(15). 03 BIRTH횯ATE PIC X(10). 03 ACCOUNT횼UM PIC 9(8). 03 CURRENT횫GE PIC 999. 03 DUE횯ATE PIC X(10). 03 BENNY횲ACTOR PIC 9(3) COMP�3. 03 ADJUSTMENT PIC 9(3) COMP�3. 03 PAYOUT PIC S9(7) COMP�3. 03 PIC X(20). WORKING훁TORAGE SECTION. 01 RUNDATA횲S PIC 99. 77 EOF횵ND PIC X. 88 EOF VALUE "Y". 88 NOT횱OF VALUE "N". 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 GUIDE Fall 1996 AP850 IBM COBOL 23 COBOL example MAIN IBM 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 PROCEDURE DIVISION. OPENIT. OPEN INPUT RUNDATA. IF RUNDATA횲S NOT EQUAL TO 0 DISPLAY "** ERROR ** " "CAN'T OPEN RUNDATA FILE **" ELSE SET NOT횱OF TO TRUE PERFORM LOOP CLOSE RUNDATA END횵F STOP RUN LOOP. PERFORM UNTIL EOF READ RUNDATA AT END SET EOF TO TRUE NOT AT END CALL "SUBRTN" USING WORK훀ECORD END훀EAD END횾ERFORM. END PROGRAM MAIN. 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 GUIDE Fall 1996 AP850 IBM COBOL 24 COBOL example SUBRTN IBM 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 ID DIVISION. PROGRAM횵D. SUBRTN. DATA DIVISION. ************************************************** * IMPORTANT NOTE!!! * ************************************************** * This sample requires the compiler option * * INTDATE(LILIAN). To get this sample to work * * with INTDATE(ANSI), change all the references * * of CEEDAYS to CEECBLDY. * ************************************************** 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 GUIDE Fall 1996 AP850 IBM COBOL 25 COBOL example SUBRTN IBM 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 WORKING훁TORAGE SECTION. 01 CURR횯ATE. 05 CURR훊EAR PIC 9(4). 05 CURR횺ONTH PIC 99. 05 CURR횯AY PIC 99. 77 YEARS횸EFT PIC 9(4). ************************************************* * Parameters for CEEDAYS and CEESCEN * ************************************************* 01 PICSTR. 05 PICSTR횸ENGTH PIC 9(2) COMP VALUE 8. 05 PICSTR훁TRING PIC X(50) VALUE "MM/DD/YY". 77 LILIAN PIC 9(9) COMP. 77 START횮W PIC 9(9) COMP. 77 FC PIC X(12). ************************************************* * Working Storage for DATE횽F횵NTEGER * ************************************************* 01 4횯IGIT횯ATE PIC 9(8). 01 4횯IGIT훀EDEFINED REDEFINES 4횯IGIT횯ATE. 05 YYYY PIC 9(4). 05 MM PIC 9(2). 05 DD PIC 9(2). 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 GUIDE Fall 1996 AP850 IBM COBOL 26 COBOL example SUBRTN IBM 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 LINKAGE SECTION. ************************************************* * Linkage Section description of the record * * that is read by MAIN, and shared by SUB. * * Note that BIRTH횯ATE and DUE횯ATE * * are expanded to show formats. * ************************************************* 01 WORK훀ECORD. 03 CUST횼AME. 05 FIRST횼AME PIC X(10). 05 LAST횼AME PIC X(15). 03 BIRTH횯ATE. 05 PIC 9(4) COMP. 05 BMONTH PIC 99. 05 PIC X. 05 BDAY PIC 99. 05 PIC X. 05 BYEAR PIC 99. 03 ACCOUNT횼UM PIC 9(8). 03 CURRENT횫GE PIC 999. 03 DUE횯ATE. 05 PIC 9(4) COMP. 05 DMONTH PIC 99. 05 PIC X. 05 DDAY PIC 99. 05 PIC X. 05 DYEAR PIC 99. 03 BENNY횲ACTOR PIC 9(3) COMP�3. 03 ADJUSTMENT PIC 9(3) COMP�3. 03 PAYOUT PIC S9(7) COMP�3. 03 PIC X(20). 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 GUIDE Fall 1996 AP850 IBM COBOL 27 COBOL example SUBRTN IBM 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 PROCEDURE DIVISION USING WORK훀ECORD. ************************************************** * get todays date with 4훐igit year. * ************************************************** MOVE FUNCTION CURRENT횯ATE(1:8) TO CURR횯ATE. ************************************************** * set century window to start with the current * * year (current system date). * ************************************************** MOVE 0 TO START횮W. CALL "CEESCEN" USING START횮W FC. ************************************************** * convert 2훐igit due date year from input file * * into integer value using LE/370 service to get * * a Lilian date. CEEDAYS works only if this * * program is compiled with option INTDATE(LILIAN)* ************************************************** CALL "CEEDAYS" USING DUE횯ATE PICSTR LILIAN FC. ************************************************** * convert COBOL Lilian date into YYYYMMDD format * ************************************************** COMPUTE 4횯IGIT횯ATE = FUNCTION DATE횽F횵NTEGER(LILIAN). ************************************************** * find out how many years until due date * ************************************************** COMPUTE YEARS횸EFT = YYYY � CURR훊EAR. 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 GUIDE Fall 1996 AP850 IBM COBOL 28 COBOL example SUBRTN IBM 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 ************************************************** * set century window to start 100 years before * * the current system date. * ************************************************** MOVE 100 TO START횮W. CALL "CEESCEN" USING START횮W FC. ************************************************** * convert 2훐igit birthdate year from input file * * into integer value using LE/370 service to get * * a Lilian date. CEEDAYS works only if this * * program is compiled with option INTDATE(LILIAN)* ************************************************** CALL "CEEDAYS" USING BIRTH횯ATE PICSTR LILIAN FC. ************************************************** * convert COBOL Lilian date into YYYYMMDD format * ************************************************** COMPUTE 4횯IGIT횯ATE = FUNCTION DATE횽F횵NTEGER(LILIAN). ************************************************** * find the age � even after 1999! * ************************************************** COMPUTE CURRENT횫GE = CURR훊EAR � YYYY. GOBACK. END PROGRAM SUBRTN. 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 GUIDE Fall 1996 AP850 IBM COBOL 29 Testing your applications IBM 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 -> Regression test * Current production data * Regular test environment -> "Time Machine" test * Keep future date machines separate from others * Do not allow future dates to corrupt: O Networks O Datasets * Ideal "Time Machine": PC Server 500 System/390 -> Other future test * Data with future dates 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 GUIDE Fall 1996 AP850 IBM COBOL 30 Look out! IBM 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 -> 25% of companies will go out of business in the year 2000 * Don't let yours be one of them -> Make sure your software vendors are fixing their Year 2000 problems * If not, you need to plan for replacements! -> Make sure all of your companies suppliers are also fixing their Year 2000 problems * Remember the GM brake division strike? 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 GUIDE Fall 1996 AP850 IBM COBOL 31 How to get more information IBM 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 -> GC28-1251: The Year 2000 and 2-digit dates: A Guide For Planning and Implementation O The manual can be downloaded from the IBM Year 2000 website O http://www.software.ibm.com/year2000/index.html -> Year 2000 Technical Support Center Ask questions via: O YEAR2000 CFORUM * (Available though TALKLINK of IBMLINK) O Y2KTSC@vnet.ibm.com -> A non-IBM Year 2000 web site (de Jaeger) O http://www.year2000.com 컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 GUIDE Fall 1996 AP850 IBM COBOL 32