000001 IDENTIFICATION  DIVISION.
000002* ProfitsConversion.
000003 PROGRAM-ID.     ProfitsConversion.
000004 ENVIRONMENT     DIVISION.
000005 CONFIGURATION   SECTION.
000006 POW-REPOSITORY.
000007     CLASS  AMethodSetProfitsConversion AS "TLB=D:\CBL4\Prof4x\PowerCOBOL\CONVERSIONS\45Convert\Debug\~build.tlb,{141E5EE6-0A07-428A-ADCF-342377A4AB08},Fujitsu-PcobForm-4"
000008     CLASS  AMixed-DCfGWnd-Main-with-DCfGroupItem-Main AS "TLB=D:\CBL4\Prof4x\PowerCOBOL\CONVERSIONS\45Convert\Debug\~build.tlb,{F06C8458-672C-11D2-81F0-00A0C9613687},Fujitsu-PcobFormWnd-4"
000009     CLASS  AMixed-DCmSText-Main-with-DCfGroupItem-Main AS "TLB=D:\CBL4\Prof4x\PowerCOBOL\CONVERSIONS\45Convert\Debug\~build.tlb,{C781B681-FDE0-44C5-919F-FD0C49047943},Fujitsu-PcobStaticText-4"
000010     CLASS  AMixed--DctFrame-with-DCfGroupItem-Main AS "TLB=D:\CBL4\Prof4x\PowerCOBOL\CONVERSIONS\45Convert\Debug\~build.tlb,{BD9F5D5C-C871-46A7-BF69-0A4BDE3E34D1},ctFRAME-ctFrameCtrl-4"
000011     CLASS  ICfDataBinding AS "TLB=D:\CBL4\Prof4x\PowerCOBOL\CONVERSIONS\45Convert\Debug\~build.tlb,{ADB7A782-9BBB-11D3-83B1-00A0C9614886}"
000012     CLASS  AMixed--DCtDEdit-with-DCfGroupItem-Main AS "TLB=D:\CBL4\Prof4x\PowerCOBOL\CONVERSIONS\45Convert\Debug\~build.tlb,{AD5B3AB7-873F-4671-BD6D-CDB7D4E5EDCE},ctDEDIT-ctDEditCtrl-6"
000013     CLASS  AMixed--DctClock-with-DCfGroupItem-Main AS "TLB=D:\CBL4\Prof4x\PowerCOBOL\CONVERSIONS\45Convert\Debug\~build.tlb,{E4D26B14-59B1-4CF6-AF67-75B8AC0D77EC},ctCLOCK-ctClockCtrl-3"
000014     CLASS  AMixed--DctPush-with-DCfGroupItem-Main AS "TLB=D:\CBL4\Prof4x\PowerCOBOL\CONVERSIONS\45Convert\Debug\~build.tlb,{D31F43ED-1455-4267-A95A-48E40E8F36FD},ctPUSH-ctPushCtrl-4"
000015     CLASS  AMixed--DctGroup-with-DCfGroupItem-Main AS "TLB=D:\CBL4\Prof4x\PowerCOBOL\CONVERSIONS\45Convert\Debug\~build.tlb,{925336D5-AA3D-49CB-B334-FA93CC47333D},ctGROUP-ctGroupCtrl-3"
000016     CLASS  AMixed-DCmCheck-Main-with-DCfGroupItem-Main AS "TLB=D:\CBL4\Prof4x\PowerCOBOL\CONVERSIONS\45Convert\Debug\~build.tlb,{5F65C6B6-6594-488F-8966-E464BFCB4F66},Fujitsu-PcobCheckBox-4"
000017     CLASS  AMixed--DctGrid-with-DCfGroupItem-Main AS "TLB=D:\CBL4\Prof4x\PowerCOBOL\CONVERSIONS\45Convert\Debug\~build.tlb,{DCADE633-FC3F-4637-AFD1-7A5E830B6871},ctGRID-ctGridCtrl-3"
000018     CLASS  AMixed--DctCombo-with-DCfGroupItem-Main AS "TLB=D:\CBL4\Prof4x\PowerCOBOL\CONVERSIONS\45Convert\Debug\~build.tlb,{DC724551-0D8A-41C1-B34E-C43B311BBDA1},ctCOMBO-ctComboCtrl-5"
000019     CLASS  AMixed--DctText-with-DCfGroupItem-Main AS "TLB=D:\CBL4\Prof4x\PowerCOBOL\CONVERSIONS\45Convert\Debug\~build.tlb,{CA5A4B06-6720-4DB0-9665-3A317E2356DC},ctTEXT-ctTextCtrl-4"
000020     CLASS  AMixed--DctNEdit-with-DCfGroupItem-Main AS "TLB=D:\CBL4\Prof4x\PowerCOBOL\CONVERSIONS\45Convert\Debug\~build.tlb,{D2EBC710-B255-41F6-9111-B46AC2833B72},ctNEDIT-ctNEditCtrl-5"
000021     CLASS  AMixed-DCmTextbox-Main-with-DCfGroupItem-Main AS "TLB=D:\CBL4\Prof4x\PowerCOBOL\CONVERSIONS\45Convert\Debug\~build.tlb,{6873FC2F-E016-4A2A-8ED7-F546C9E41D29},Fujitsu-PcobTextBox-4"
000022 .
000023 SPECIAL-NAMES.
000024 REPOSITORY.
000025 .
000026 INPUT-OUTPUT    SECTION.
000027 FILE-CONTROL.
000028*<SCRIPT DIVISION="ENVIRONMENT", SECTION="CONFIGURATION", PARAGRAPH="FILE-CONTROL">
000029     COPY  "UserF.SL".
000030     COPY "CNTLF.SL".
000031     
000032     SELECT TEXTF                 ASSIGN TO TEXTF-FULLPATH   
000033                                  ORGANIZATION IS LINE SEQUENTIAL
000034                                  ACCESS MODE  IS SEQUENTIAL
000035                                  FILE STATUS  IS TEXTF-STATUS
000036                                  LOCK MODE IS AUTOMATIC.
000037       
000038*</SCRIPT>
000039 DATA            DIVISION.
000040 BASED-STORAGE   SECTION.
000041 FILE            SECTION.
000042*<SCRIPT DIVISION="DATA", SECTION="FILE">
000043     COPY "USERF.FD" REPLACING ==USERF==  BY ==USERF GLOBAL EXTERNAL==.
000044     COPY "CNTLF.FD" REPLACING ==CNTLF==  BY ==CNTLF GLOBAL EXTERNAL==.
000045     
000046     
000047 FD  TEXTF       Global External.
000048 01  TEXTF-REC.
000049     05  Text-Data                Pic x(200).
000050     
000051*</SCRIPT>
000052 WORKING-STORAGE SECTION.
000053*<SCRIPT DIVISION="DATA", SECTION="WORKING-STORAGE">
000054     COPY "USERF.DTA".
000055     COPY "CNTLF.DTA".
000056     COPY "CBL_.DTA".
000057     
000058 01  CNTLF-KEY                    PIC 9(6)            GLOBAL External.
000059 
000060 01  Profits-Programs-Loc         Pic x(256)         Global External.
000061 01  Profits-Data-Loc             Pic x(256)         Global External.
000062 
000063 01  Version-Info-Line                               Global.
000064     05  Filler                   Pic X(08)          Value "Version ".
000065     05  Version-no               Pic X(05)          Value "4.1.0".
000066     05  Filler                   Pic X(05)          Value " S/N ".
000067     05  Serial-No                Pic 9(05)          Value Zeroes.
000068     05  Filler                   Pic X(11)          Value " Station # ".
000069     05  Station-No               Pic X(06)          Value spaces.
000070     
000071 01  User-Info-Line                                  Global.
000072     05  Filler                   Pic X(08)          Value "UserID: ".
000073     05  Username                 Pic X(12)          Value spaces.
000074     
000075 01  Company-Name-Line                               Global.
000076     05  CoName-RT                Pic X(40)          Value Spaces.
000077 01 Form-Return-Code              PIC s9(4) Comp-5   Global.
000078     
000079 01  ReturnValue                  PIC s9(4) Comp-5   Global.
000080 01  WS-AUTO-CLOSE-TIMER GLOBAL.
000081     05  WS-CLOSE-HOUR            PIC 9(5)  comp-5.
000082     05  WS-CLOSE-MIN             PIC 9(5)  comp-5.
000083     05  WS-CLOSE-SEC             PIC 9(5)  Comp-5.
000084* 300 Sec = 5min, 3000 Sec = 50Min and 86400 = 24Hrs
000085 01  WS-AUTO-CLOSE-DELAY-SECONDS  PIC 9(5)           Global VALUE 60.
000086
000087      COPY "STATUS.DTA"  REPLACING ==FILE-STATUS-CODES== BY
000088                                   ==FILE-STATUS-CODES GLOBAL==.  
000089       COPY "ERROR.DTA".
000090 01  ERROR-FIELDS     IS GLOBAL.
000091     05  FILE-STATUS     PIC XX.
000092     05  FILE-NAME       PIC X(40).
000093
000094 01  TEXTF-STATUS                 PIC XX     Global.
000095 01  TEXTF-Fullpath               PIC X(100) Global.
000096 01  ERRORS-FOUND-CD              PIC 9      GLOBAL.
000097     88 ERRORS-FOUND-YES          VALUE 1.    
000098     
000099 01  Conv-Error-CNT               PIC S9(9)  COMP-5   Global.
000100              
000101*</SCRIPT>
000102 CONSTANT        SECTION.
000103*<SCRIPT DIVISION="DATA", SECTION="CONSTANT">
000104
000105 01 Exit-Button                   PIC s9(4) comp-5  Value 101  Global.
000106 01 Return-button                 Pic s9(4) Comp-5  Value 201  Global.
000107 01 Time-Out                      Pic s9(4) Comp-5  Value 301  Global.
000108*</SCRIPT>
000109 LINKAGE         SECTION.
000110 01  POW-FORM IS GLOBAL.
000111   02  POW-SELF OBJECT REFERENCE AMethodSetProfitsConversion.
000112   02  POW-SUPER  PIC X(4).
000113   02  POW-THIS OBJECT REFERENCE AMethodSetProfitsConversion.
000114   02  StaticVersionSNInfo OBJECT REFERENCE AMixed-DCmSText-Main-with-DCfGroupItem-Main.
000115   02  StaticUserID OBJECT REFERENCE AMixed-DCmSText-Main-with-DCfGroupItem-Main.
000116   02  StaticMenuOptionName OBJECT REFERENCE AMixed-DCmSText-Main-with-DCfGroupItem-Main.
000117   02  StaticCoName OBJECT REFERENCE AMixed-DCmSText-Main-with-DCfGroupItem-Main.
000118   02  ctFrameHdrBar OBJECT REFERENCE AMixed--DctFrame-with-DCfGroupItem-Main.
000119   02  ctDEditSystemDate OBJECT REFERENCE AMixed--DCtDEdit-with-DCfGroupItem-Main.
000120   02  ctClockSysTime OBJECT REFERENCE AMixed--DctClock-with-DCfGroupItem-Main.
000121   02  ctClockAutoClose OBJECT REFERENCE AMixed--DctClock-with-DCfGroupItem-Main.
000122   02  ctClockAlarmTime OBJECT REFERENCE AMixed--DctClock-with-DCfGroupItem-Main.
000123   02  ctFrame1 OBJECT REFERENCE AMixed--DctFrame-with-DCfGroupItem-Main.
000124   02  ctPushExit OBJECT REFERENCE AMixed--DctPush-with-DCfGroupItem-Main.
000125   02  ctPushConvert OBJECT REFERENCE AMixed--DctPush-with-DCfGroupItem-Main.
000126   02  ctGroup1 OBJECT REFERENCE AMixed--DctGroup-with-DCfGroupItem-Main.
000127   02  ctPushDeSelectAll OBJECT REFERENCE AMixed--DctPush-with-DCfGroupItem-Main.
000128   02  ctPushSelectAll OBJECT REFERENCE AMixed--DctPush-with-DCfGroupItem-Main.
000129   02  CmCheckItemFile OBJECT REFERENCE AMixed-DCmCheck-Main-with-DCfGroupItem-Main.
000130   02  ctGroupResults OBJECT REFERENCE AMixed--DctGroup-with-DCfGroupItem-Main.
000131   02  ctGridResults OBJECT REFERENCE AMixed--DctGrid-with-DCfGroupItem-Main.
000132   02  ctComboCompanyFolder OBJECT REFERENCE AMixed--DctCombo-with-DCfGroupItem-Main.
000133   02  CmCheckSaveOrg OBJECT REFERENCE AMixed-DCmCheck-Main-with-DCfGroupItem-Main.
000134   02  ctTextCurrStatus OBJECT REFERENCE AMixed--DctText-with-DCfGroupItem-Main.
000135   02  ctTextPKey OBJECT REFERENCE AMixed--DctText-with-DCfGroupItem-Main.
000136   02  CmStaticReadCnt OBJECT REFERENCE AMixed-DCmSText-Main-with-DCfGroupItem-Main.
000137   02  ctNEditReadCnt OBJECT REFERENCE AMixed--DctNEdit-with-DCfGroupItem-Main.
000138   02  CmStaticWriteCnt OBJECT REFERENCE AMixed-DCmSText-Main-with-DCfGroupItem-Main.
000139   02  ctNEditWriteCnt OBJECT REFERENCE AMixed--DctNEdit-with-DCfGroupItem-Main.
000140   02  CmStaticErrorCnt OBJECT REFERENCE AMixed-DCmSText-Main-with-DCfGroupItem-Main.
000141   02  ctNEditErrorCnt OBJECT REFERENCE AMixed--DctNEdit-with-DCfGroupItem-Main.
000142   02  CmCheckChrtFile OBJECT REFERENCE AMixed-DCmCheck-Main-with-DCfGroupItem-Main.
000143   02  ctNEditConvCnt OBJECT REFERENCE AMixed--DctNEdit-with-DCfGroupItem-Main.
000144   02  CmStaticConvCnt OBJECT REFERENCE AMixed-DCmSText-Main-with-DCfGroupItem-Main.
000145   02  CmStaticFolderName OBJECT REFERENCE AMixed-DCmSText-Main-with-DCfGroupItem-Main.
000146   02  CmTextFolder OBJECT REFERENCE AMixed-DCmTextbox-Main-with-DCfGroupItem-Main.
000147   02  CmStaticMultiWhse OBJECT REFERENCE AMixed-DCmSText-Main-with-DCfGroupItem-Main.
000148   02  CmTextMultiWhse OBJECT REFERENCE AMixed-DCmTextbox-Main-with-DCfGroupItem-Main.
000149   02  CmCheckPoHdFile OBJECT REFERENCE AMixed-DCmCheck-Main-with-DCfGroupItem-Main.
000150   02  CmCheckItrnFile OBJECT REFERENCE AMixed-DCmCheck-Main-with-DCfGroupItem-Main.
000151   02  CmCheckOrdLFile OBJECT REFERENCE AMixed-DCmCheck-Main-with-DCfGroupItem-Main.
000152   02  CmCheckStylFile OBJECT REFERENCE AMixed-DCmCheck-Main-with-DCfGroupItem-Main.
000153   02  CmCheckMUCTFile OBJECT REFERENCE AMixed-DCmCheck-Main-with-DCfGroupItem-Main.
000154 01  ProfitsConversion REDEFINES POW-FORM GLOBAL OBJECT REFERENCE AMethodSetProfitsConversion.
000155 01  POW-CONTROL-ID PIC S9(9) COMP-5.
000156 01  POW-EVENT-ID   PIC S9(9) COMP-5.
000157 01  POW-OLE-PARAM  PIC X(4).
000158 01  POW-OLE-RETURN PIC X(4).
000159 01  WK-COB-PARAM.
000160   02  WK-DEFAULT-PARAM PIC X(8).
000161   02  WK-SCRIPTLET2 REDEFINES WK-DEFAULT-PARAM.
000162     03  POW-ARG-00  PIC S9(4) COMP-5.
000163     03  POW-ARG-01  PIC S9(9) COMP-5.
000164     03  POW-ARG-02  PIC S9(4) COMP-5.
000165   02  WK-SCRIPTLET27 REDEFINES WK-DEFAULT-PARAM.
000166     03  POW-ARG-00  PIC S9(4) COMP-5.
000167   02  WK-SCRIPTLET32 REDEFINES WK-DEFAULT-PARAM.
000168     03  POW-ARG-00  PIC S9(4) COMP-5.
000169     03  POW-ARG-01  PIC S9(4) COMP-5.
000170     03  POW-ARG-02  PIC S9(4) COMP-5.
000171   02  WK-COB-PARAM-LEN PIC S9(9) COMP-5.
000172   02  WK-OLE-PARAM-NUM PIC S9(9) COMP-5.
000173   02  WK-OLE-VT-LIST.
000174     03  WK-OLE-VT1 PIC S9(9) COMP-5.
000175     03  WK-OLE-VT2 PIC S9(9) COMP-5.
000176     03  WK-OLE-VT3 PIC S9(9) COMP-5.
000177 PROCEDURE       DIVISION USING POW-FORM POW-CONTROL-ID POW-EVENT-ID POW-OLE-PARAM POW-OLE-RETURN WK-COB-PARAM.
000178     EVALUATE POW-CONTROL-ID
000179     WHEN 117440513
000180     EVALUATE POW-EVENT-ID
000181     WHEN 117440776
000182       MOVE 8 TO WK-COB-PARAM-LEN
000183       MOVE 3 TO WK-OLE-PARAM-NUM
000184       MOVE 33751051 TO WK-OLE-VT1
000185       MOVE 33619971 TO WK-OLE-VT2
000186       MOVE 33619970 TO WK-OLE-VT3
000187       CALL "XPOW_SET_COBOL_PARAM" USING POW-OLE-PARAM WK-COB-PARAM    BY VALUE WK-COB-PARAM-LEN WK-OLE-PARAM-NUM
000188         WK-OLE-VT1
000189         WK-OLE-VT2
000190         WK-OLE-VT3
000191       CALL "POW-SCRIPTLET2" USING
000192         POW-ARG-00 OF WK-SCRIPTLET2
000193         POW-ARG-01 OF WK-SCRIPTLET2
000194         POW-ARG-02 OF WK-SCRIPTLET2
000195       CALL "XPOW_CPY_COBOL_PARAM" USING POW-OLE-PARAM WK-COB-PARAM POW-OLE-RETURN BY VALUE WK-COB-PARAM-LEN WK-OLE-PARAM-NUM
000196         WK-OLE-VT1
000197         WK-OLE-VT2
000198         WK-OLE-VT3
000199     WHEN 117440768
000200       CALL "POW-SCRIPTLET3"
000201     END-EVALUATE
000202     WHEN 117440548
000203     EVALUATE POW-EVENT-ID
000204     WHEN 1
000205       MOVE 6 TO WK-COB-PARAM-LEN
000206       MOVE 3 TO WK-OLE-PARAM-NUM
000207       MOVE 33554434 TO WK-OLE-VT1
000208       MOVE 33554434 TO WK-OLE-VT2
000209       MOVE 33554434 TO WK-OLE-VT3
000210       CALL "XPOW_SET_COBOL_PARAM" USING POW-OLE-PARAM WK-COB-PARAM    BY VALUE WK-COB-PARAM-LEN WK-OLE-PARAM-NUM
000211         WK-OLE-VT1
000212         WK-OLE-VT2
000213         WK-OLE-VT3
000214       CALL "POW-SCRIPTLET32" USING
000215         POW-ARG-00 OF WK-SCRIPTLET32
000216         POW-ARG-01 OF WK-SCRIPTLET32
000217         POW-ARG-02 OF WK-SCRIPTLET32
000218       CALL "XPOW_CPY_COBOL_PARAM" USING POW-OLE-PARAM WK-COB-PARAM POW-OLE-RETURN BY VALUE WK-COB-PARAM-LEN WK-OLE-PARAM-NUM
000219         WK-OLE-VT1
000220         WK-OLE-VT2
000221         WK-OLE-VT3
000222     END-EVALUATE
000223     WHEN 117440557
000224     EVALUATE POW-EVENT-ID
000225     WHEN -600
000226       CALL "POW-SCRIPTLET25"
000227     END-EVALUATE
000228     WHEN 117440572
000229     EVALUATE POW-EVENT-ID
000230     WHEN -600
000231       CALL "POW-SCRIPTLET31"
000232     END-EVALUATE
000233     WHEN 117440573
000234     EVALUATE POW-EVENT-ID
000235     WHEN -600
000236       CALL "POW-SCRIPTLET1"
000237     END-EVALUATE
000238     WHEN 117440584
000239     EVALUATE POW-EVENT-ID
000240     WHEN -600
000241       CALL "POW-SCRIPTLET29"
000242     END-EVALUATE
000243     WHEN 117440585
000244     EVALUATE POW-EVENT-ID
000245     WHEN -600
000246       CALL "POW-SCRIPTLET28"
000247     END-EVALUATE
000248     WHEN 117440586
000249     EVALUATE POW-EVENT-ID
000250     WHEN -2147405823
000251       CALL "POW-SCRIPTLET23"
000252     WHEN -2147405824
000253       CALL "POW-SCRIPTLET24"
000254     WHEN -600
000255       CALL "POW-SCRIPTLET30"
000256     END-EVALUATE
000257     WHEN 117440594
000258     EVALUATE POW-EVENT-ID
000259     WHEN 2
000260       MOVE 2 TO WK-COB-PARAM-LEN
000261       MOVE 1 TO WK-OLE-PARAM-NUM
000262       MOVE 33554434 TO WK-OLE-VT1
000263       CALL "XPOW_SET_COBOL_PARAM" USING POW-OLE-PARAM WK-COB-PARAM    BY VALUE WK-COB-PARAM-LEN WK-OLE-PARAM-NUM
000264         WK-OLE-VT1
000265       CALL "POW-SCRIPTLET27" USING
000266         POW-ARG-00 OF WK-SCRIPTLET27
000267       CALL "XPOW_CPY_COBOL_PARAM" USING POW-OLE-PARAM WK-COB-PARAM POW-OLE-RETURN BY VALUE WK-COB-PARAM-LEN WK-OLE-PARAM-NUM
000268         WK-OLE-VT1
000269     END-EVALUATE
000270     WHEN 117440596
000271     EVALUATE POW-EVENT-ID
000272     WHEN -2147405823
000273       CALL "POW-SCRIPTLET19"
000274     WHEN -2147405824
000275       CALL "POW-SCRIPTLET20"
000276     END-EVALUATE
000277     WHEN 117440621
000278     EVALUATE POW-EVENT-ID
000279     WHEN -2147405823
000280       CALL "POW-SCRIPTLET21"
000281     WHEN -2147405824
000282       CALL "POW-SCRIPTLET22"
000283     WHEN -600
000284       CALL "POW-SCRIPTLET26"
000285     END-EVALUATE
000286     WHEN 117440640
000287     EVALUATE POW-EVENT-ID
000288     WHEN -2147405823
000289       CALL "POW-SCRIPTLET16"
000290     WHEN -2147405824
000291       CALL "POW-SCRIPTLET17"
000292     WHEN -600
000293       CALL "POW-SCRIPTLET18"
000294     END-EVALUATE
000295     WHEN 117440642
000296     EVALUATE POW-EVENT-ID
000297     WHEN -2147405823
000298       CALL "POW-SCRIPTLET13"
000299     WHEN -2147405824
000300       CALL "POW-SCRIPTLET14"
000301     WHEN -600
000302       CALL "POW-SCRIPTLET15"
000303     END-EVALUATE
000304     WHEN 117440643
000305     EVALUATE POW-EVENT-ID
000306     WHEN -2147405823
000307       CALL "POW-SCRIPTLET4"
000308     WHEN -2147405824
000309       CALL "POW-SCRIPTLET5"
000310     WHEN -600
000311       CALL "POW-SCRIPTLET6"
000312     END-EVALUATE
000313     WHEN 117440644
000314     EVALUATE POW-EVENT-ID
000315     WHEN -2147405823
000316       CALL "POW-SCRIPTLET7"
000317     WHEN -2147405824
000318       CALL "POW-SCRIPTLET8"
000319     WHEN -600
000320       CALL "POW-SCRIPTLET9"
000321     END-EVALUATE
000322     WHEN 117440645
000323     EVALUATE POW-EVENT-ID
000324     WHEN -2147405823
000325       CALL "POW-SCRIPTLET10"
000326     WHEN -2147405824
000327       CALL "POW-SCRIPTLET11"
000328     WHEN -600
000329       CALL "POW-SCRIPTLET12"
000330     END-EVALUATE
000331     END-EVALUATE
000332     EXIT PROGRAM.
000333 IDENTIFICATION  DIVISION.
000334* ProcConvertMUCTF.
000335 PROGRAM-ID.     ProcConvertMUCTF IS COMMON.
000336*<SCRIPT DIVISION="PROCEDURE", NAME="ProcConvertMUCTF">
000337 ENVIRONMENT     DIVISION.
000338 INPUT-OUTPUT SECTION.
000339 FILE-CONTROL.
000340     COPY "MUCTF.SL".
000341     COPY "SCATF.SL".
000342     COPY "SCGRF.SL".
000343     
000344 DATA            DIVISION.
000345 FILE SECTION.
000346     COPY "MUCTF.FD".
000347     COPY "SCATF.FD".
000348     COPY "SCGRF.FD".
000349     
000350 WORKING-STORAGE SECTION.
000351     COPY "MUCTF.DTA".
000352     COPY "SCATF.DTA".
000353     COPY "SCGRF.DTA".
000354     COPY "APPAREL.DTA".
000355
000356 01  Grid-Comment                 Pic x(150)          Value spaces.
000357 01  Grid-Filename                pic x(30)           Value spaces.
000358 01  Grid-Index                   Pic s9(9)  Comp-5   Value zero.
000359 
000360 01  REC-READ-CNT                 PIC S9(9)  COMP-5   VALUE ZERO.
000361 01  REC-WRITE-CNT                PIC S9(9)  COMP-5   VALUE ZERO.
000362 01  REC-ERROR-CNT                PIC S9(9)  COMP-5   VALUE ZERO.
000363 01  Ws-Error-Code                pic -9999           value zero.
000364 77  WHSE-NUMERIC                 PIC 9999            VALUE ZERO.
000365 77  CNT                          PIC S9(6)           VALUE ZERO.
000366 77  CNT2                         PIC S9(6)           VALUE ZERO.
000367 77  CNT3                         PIC S9(6)           VALUE ZERO.
000368 01  SV PIC 9.
000369 01  Error-Line.
000370     05  Filler                   Pic X(12)  value "Write Error=".
000371     05  Dsp-Error-Code           Pic xx     value spaces.
000372     05  Filler                   Pic X(07)  value " Write:".
000373     05  Dsp-Error-Key            Pic x(30)  value spaces.
000374
000375 01  Counts-Line.
000376     05  Filler                   Pic X(05)  value "Read:".
000377     05  Dsp-Read-Cnt             Pic z,zzz,zz9 value zero.
000378     05  Filler                   Pic X(07)  value " Write:".
000379     05  Dsp-Write-Cnt            Pic z,zzz,zz9 value zero.
000380     05  Filler                   Pic X(08)  value " Errors:".
000381     05  Dsp-Error-Cnt            Pic z,zzz,zz9 value zero.
000382
000383 01  MSG-STYLE                    PIC S9(9)  COMP-5   Value Zero.
000384 
000385 01  WS-File-Exists-msg.
000386     05  Filler                   pic x(40) value "The new data file already Exists!".
000387     05  Filler                   Pic X     value x"0A".
000388     05  filler                   pic x(40) Value "Do you want to overwrite it?".
000389     
000390 01  WS-New-File-Error-msg.
000391     05  Filler                   pic x(40) value "The file to be converted has returned".
000392     05  Filler                   Pic X     value x"0A".
000393     05  Filler                   pic x(40) value " an error!".
000394     05  Filler                   Pic X     value x"0A".
000395     05  filler                   pic x(40) Value "File conversion aborted!".
000396     
000397 01  WS-Old-File-Error-msg.
000398     05  Old-File-Msg            pic x(40) value "The file to be converted was not found!".
000399     05  Filler                   Pic X     value x"0A".
000400     05  filler                   pic x(40) Value "File conversion aborted!".
000401     
000402 
000403 PROCEDURE       DIVISION.
000404 DECLARATIVES.
000405     COPY "MUCTF.DS".
000406     COPY "SCATF.DS".
000407     COPY "SCGRF.DS".
000408     GO TO STATUS-EXIT.
000409        
000410 STATUS-CHECK.
000411           IF FILE-STATUS = RECORD-LOCK OR DUPLICATE-RECORD
000412              or NO-FILE or STRUCTURE-MISMATCH or PERMANENT-ERROR
000413              GO TO STATUS-EXIT.
000414
000415           SET DBIO OF ERROR-KIND TO TRUE.
000416           MOVE FILE-NAME        TO ERROR-DBIO.
000417           MOVE FILE-STATUS      TO IOSTATUS OF ERROR-DBIO.
000418           MOVE "45CONVERT.EXE"    TO ERROR-PROGRNAME.
000419           INVOKE POW-SELF "CallForm" USING "DBIOERROR" "ERRORBOX"
000420                 RETURNING ReturnValue.
000421           INVOKE POW-SELF "CloseForm" USING "ProfitsConversion"
000422                 RETURNING ReturnValue.
000423           EXIT PROGRAM.
000424           
000425 STATUS-EXIT. EXIT.       
000426 END DECLARATIVES. 
000427 BEGIN-PROGRAM.
000428     Move zero to Rec-Read-Cnt, Rec-Write-Cnt, Rec-Error-Cnt.
000429     MOVE "MUCNTL.FIL"     TO MUCTF--NAME.
000430     MOVE "SIZECAT.FIL"    TO SCATF--NAME.
000431     MOVE "SZCATGRP.FIL"   TO SCGRF--NAME.
000432     MOve zero to Msg-Style.
000433     
000434     PERFORM STRING-FILENAMES.
000435     Move Spaces to Grid-Comment.
000436     String "Working on: "          delimited by size
000437            MUCTF-fullpath          delimited by space
000438            into Grid-Comment.
000439     Move Grid-Comment to "Caption" OF ctTextCurrStatus.
000440*     Move Pow-Color-Gray to "ItemBackColor"(grid-index) OF ctGridResults.
000441       
000442 CHECK-FOR-FILES.
000443     OPEN INPUT MUCTF.
000444*-- The file to be converted does not exist, Abort the conversion --*
000445     IF MUCTF-STATUS = NO-FILe
000446        MOVE "The file to be converted was not found." TO OLD-FILE-MSG
000447        PERFORM OLD-FILE-ERROR-MSG
000448        Move Zero   to Grid-Index
000449        Move spaces to Grid-Comment
000450        string MUCTF-fullpath     delimited by space
000451               " - Not Found, Conversion Aborted.    " delimited by size
000452               into Grid-Comment
000453        PERFORM ADD-GRID-LINE
000454        Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
000455        Add 1 to Conv-Error-Cnt
000456        Go to End-Program.
000457
000458*-- The file was found, but is not the correct starting layout (structure) --*
000459     IF MUCTF-STATUS = STRUCTURE-MISMATCH
000460        MOVE "Wrong Starting version of this file." TO OLD-FILE-MSG
000461        PERFORM OLD-FILE-ERROR-MSG
000462        Move Zero   to Grid-Index
000463        Move spaces to Grid-Comment
000464        string MUCTF-fullpath     delimited by space
000465               " - Wrong Starting Structure, Conversion Aborted.    " delimited by size
000466               into Grid-Comment
000467        PERFORM ADD-GRID-LINE
000468        Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
000469        Add 1 to Conv-Error-Cnt
000470        Go to End-Program.
000471    
000472*-- The file was found, but it appears to be corrupted --*
000473     IF MUCTF-STATUS = PERMANENT-ERROR
000474        MOVE "The file seems to be corrupted." TO OLD-FILE-MSG
000475        PERFORM OLD-FILE-Error-Msg
000476        Move Zero   to Grid-Index
000477        Move spaces to Grid-Comment
000478        string MUCTF-fullpath     delimited by space
000479               " - Corrupted, Try rebuilding it. Conversion Aborted.    " delimited by size
000480               into Grid-Comment
000481        PERFORM ADD-GRID-LINE
000482        Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
000483         Add 1 to Conv-Error-Cnt
000484        Go to End-Program.
000485
000486  
000487 File-Tests-Passed.                   
000488     Move Spaces to Grid-Comment.
000489     String "Converting - "          delimited by size
000490            MUCTF-fullpath           delimited by space
000491            into Grid-Comment.
000492     perform Add-Grid-Line.
000493     Open Output SCATF.
000494     Open Output SCGRF.
000495     
000496 START-DATA-CONVERSION.
000497     PERFORM  PROCESS-RECORD UNTIL MUCTF-STATUS NOT = FOUND.
000498     CLOSE MUCTF, SCATF, SCGRF.
000499
000500 Update-Grid-With-Counts.
000501     Move Rec-Read-Cnt to Dsp-Read-Cnt.
000502     Move Rec-Write-Cnt to Dsp-Write-Cnt.
000503     Move Rec-Error-Cnt to Dsp-Error-Cnt.
000504     Move Counts-Line to Grid-Comment.
000505     Perform Add-Grid-Line.
000506       
000507 RENAME-FILES.
000508     If "Value" OF CmCheckSaveOrg = Pow-Tristate-Checked
000509        Perform Save-Original-File
000510        If Cbl_Status_Code not = Zero
000511           Move "MUCT File Conversion Aborted" to Grid-Comment
000512           Perform ADD-GRID-LINE
000513           Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
000514           Add 1 to Conv-Error-Cnt
000515           Go To End-Program
000516        else
000517           Perform Delete-Original-File
000518           If Cbl_Status_Code not = Zero
000519              Move "Original File Delete Failed" to Grid-Comment
000520              Perform ADD-GRID-LINE
000521              Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
000522              Move "MUCT File Conversion Aborted" to Grid-Comment
000523              Perform ADD-GRID-LINE
000524              Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
000525              Add 1 to Conv-Error-Cnt
000526              Go To End-Program
000527           else
000528              Next Sentence
000529     Else
000530        Perform Delete-Original-File
000531        If Cbl_Status_Code not = Zero
000532           Move "Original File Delete Failed" to Grid-Comment
000533           Perform ADD-GRID-LINE
000534           Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
000535           Move "MUCT File Conversion Aborted" to Grid-Comment
000536           Perform ADD-GRID-LINE
000537           Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
000538           Add 1 to Conv-Error-Cnt
000539           Go To End-Program.
000540        
000541 FINISHED-CONVERSION.
000542        Move "MUCT File Conversion Successful" to Grid-Comment.
000543        Perform ADD-GRID-LINE.
000544        Move Pow-Color-Green to "ItemBackColor"(grid-index) OF ctGridResults.
000545     
000546 END-PROGRAM.
000547     EXIT PROGRAM.     
000548
000549 SUBROUTINE SECTION.
000550 STRING-FILENAMES.     
000551       MOVE SPACES TO MUCTF-FULLPATH.
000552       String  Profits-Programs-Loc   delimited by space
000553               "\"                    DELIMITED BY SIZE
000554               Profits-Data-Loc       delimited by space
000555               "\"                    DELIMITED BY SIZE
000556               MUCTF--NAME            DELIMITED BY SPACE
000557               INTO MUCTF-FULLPATH.
000558
000559       MOVE SPACES TO SCATF-FULLPATH.
000560       String  Profits-Programs-Loc   delimited by space
000561               "\"                    DELIMITED BY SIZE
000562               Profits-Data-Loc       delimited by space
000563               "\"                    DELIMITED BY SIZE
000564               SCATF--NAME             DELIMITED BY SPACE
000565               INTO SCATF-FULLPATH.
000566
000567       MOVE SPACES TO SCGRF-FULLPATH.
000568       String  Profits-Programs-Loc   delimited by space
000569               "\"                    DELIMITED BY SIZE
000570               Profits-Data-Loc       delimited by space
000571               "\"                    DELIMITED BY SIZE
000572               SCGRF--NAME             DELIMITED BY SPACE
000573               INTO SCGRF-FULLPATH.
000574
000575 ADD-GRID-LINE.
000576     move zero to Grid-Index.
000577     INVOKE ctGridResults "InsertItem" USING Grid-Comment Grid-Index RETURNING ReturnValue.
000578
000579
000580 New-File-Already-Exists.
000581      If C-found of MUCTF-Status
000582         close MUCTF.
000583      Move zero       to Msg-Style.
000584      Add Pow-DMYesNo to Msg-Style.
000585      Add Pow-DMIconQuestion to Msg-Style.
000586      INVOKE Pow-Self "DisplayMessage" 
000587             USING Ws-File-Exists-Msg
000588                   "Profits Warning"
000589                   msg-style
000590             RETURNING ReturnValue.
000591
000592 New-File-Other-Error.
000593      Move zero    to Msg-Style.
000594      Add Pow-DMOK to Msg-Style.
000595      Add Pow-DMIconExclamation to Msg-Style.
000596      INVOKE Pow-Self "DisplayMessage" 
000597             USING Ws-new-File-Error-Msg
000598                   "Profits Warning"
000599                   msg-style
000600             RETURNING ReturnValue.
000601
000602 OLD-File-Error-Msg.
000603      Move zero        to Msg-Style.
000604      Add Pow-DMOK     to Msg-Style.
000605      Add Pow-DMIconExclamation to Msg-Style.
000606      INVOKE Pow-Self "DisplayMessage" 
000607             USING Ws-Old-file-Error-msg
000608                   "Profits Warning"
000609                   msg-style
000610             RETURNING ReturnValue.
000611             
000612 PROCESS-RECORD.
000613     MOVE 1 TO MUCTF-KEY.
000614     READ MUCTF.
000615     PERFORM VARYING CNT FROM 1 BY 1 UNTIL CNT > 9
000616       IF MUCT-GROUP-NAME(CNT) NOT = SPACES
000617          MOVE MUCT-GROUP-NAME(CNT) TO SCGR-NAME
000618          MOVE CNT TO SCGR-NUMBER
000619          PERFORM WRITE-SCGRF-REC
000620            PERFORM VARYING CNT2 FROM 1 BY 1 UNTIL CNT2 > 9
000621             PERFORM VARYING CNT3 FROM 1 BY 1 UNTIL CNT3 > 9
000622                IF MUCT-SIZES(CNT, CNT2) NOT = SPACES AND
000623                   MUCT-CATEGORIES(CNT, CNT3) NOT = SPACES
000624                     MOVE CNT TO SCAT-GROUP-NBR
000625                     MOVE MUCT-SIZES(CNT, CNT2) TO SCAT-SIZE
000626                     MOVE MUCT-CATEGORIES(CNT, CNT3) TO SCAT-CAT
000627                     MOVE CNT2 TO SV
000628                     MOVE SV TO LOPT-X
000629                     MOVE LOPT-X TO SCAT-SIZE-NUM 
000630                     MOVE CNT3 TO SV
000631                     MOVE SV TO LOPT-X
000632                     MOVE LOPT-X TO SCAT-CAT-NUM 
000633                     PERFORM WRITE-SCATF-REC
000634                END-IF
000635              END-PERFORM 
000636             END-PERFORM 
000637       END-IF
000638     END-PERFORM.
000639     MOVE NOT-FOUND TO MUCTF-STATUS.
000640 
000641 Save-Original-File.
000642      MOVE MUCTF-FULLPATH  TO CBL_FROM_PATH, CBL_TO_PATH.
000643      INSPECT CBL_TO_PATH REPLACING FIRST ".FIL" BY ".ORG".
000644      CALL "CBL_COPY_FILE"
000645           USING CBL_FROM_PATH CBL_TO_PATH 
000646           RETURNING CBL_STATUS_CODE.
000647      IF CBL_STATUS_CODE NOT = ZERO
000648         MOVE CBL_STATUS_CODE TO WS-ERROR-CODE
000649         MOVE SPACES TO GRID-COMMENT
000650         STRING "Error = "         DELIMITED BY size
000651                WS-ERROR-CODE      DELIMITED BY SIZE
000652                " - Save Original Failed" delimited by size
000653                into Grid-Comment
000654         perform ADD-GRID-LINE
000655         Add 1 to Conv-Error-Cnt
000656         Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults.
000657      
000658 Delete-Original-File.
000659      MOVE MUCTF-FULLPATH  TO CBL_FROM_PATH.
000660      Call "CBL_DELETE_FILE"
000661           using CBL_From_Path
000662           Returning CBL_Status_Code.
000663           
000664 Rename-New-File.
000665      MOVE MUCTF-FULLPATH TO CBL_TO_PATH, CBL_FROM_PATH.
000666      INSPECT CBL_TO_PATH REPLACING FIRST ".V45" BY ".FIL".
000667      CALL "CBL_RENAME_FILE"
000668           USING CBL_FROM_PATH CBL_TO_PATH
000669           RETURNING CBL_STATUS_CODE.
000670          
000671      
000672 SUBROUTINE-EXIT. EXIT.     
000673 
000674  IN-OUT SECTION.
000675 WRITE-SCGRF-REC.
000676     WRITE SCGRF-REC
000677         INVALID KEY MOVE SCGRF-STATUS TO SCGRF-STATUS.
000678     IF C-FOUND OF SCGRF-STATUS
000679        ADD 1 TO REC-WRITE-CNT
000680     ELSE
000681        Move SCGRF-Status to DSP-Error-Code
000682        move SCGRF-Key    to Dsp-Error-Key
000683        move Error-Line to Grid-Comment
000684        Perform Add-Grid-Line
000685        Add 1 to Conv-Error-Cnt
000686        Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
000687        ADD 1 TO REC-ERROR-CNT.     
000688 WRITE-SCATF-REC.
000689     WRITE SCATF-REC
000690         INVALID KEY MOVE SCATF-STATUS TO SCATF-STATUS.
000691     IF C-FOUND OF SCATF-STATUS
000692        ADD 1 TO REC-WRITE-CNT
000693     ELSE
000694        Move SCATF-Status to DSP-Error-Code
000695        move SCATF-Key    to Dsp-Error-Key
000696        move Error-Line to Grid-Comment
000697        Perform Add-Grid-Line
000698        Add 1 to Conv-Error-Cnt
000699        Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
000700        ADD 1 TO REC-ERROR-CNT.     
000701         
000702  IN-OUT-EXIT. EXIT. 
000703*</SCRIPT>
000704 END PROGRAM     ProcConvertMUCTF.
000705 IDENTIFICATION  DIVISION.
000706* ProcSetButtonConvert.
000707 PROGRAM-ID.     ProcSetButtonConvert IS COMMON.
000708*<SCRIPT DIVISION="PROCEDURE", NAME="ProcSetButtonConvert">
000709 ENVIRONMENT     DIVISION.
000710 DATA            DIVISION.
000711 WORKING-STORAGE SECTION.
000712 01  Files-Selected-Cd            PIC  X    Value "N".
000713     88 Files-Selected-Yes                 Value "Y".
000714 
000715 PROCEDURE       DIVISION.
000716 BEGIN-PROGRAM.
000717     Move "N"   to Files-Selected-Cd.
000718     If "Value" OF CmCheckItemFile = Pow-tristate-Checked or
000719        "Value" OF CmCheckChrtFile = Pow-tristate-Checked or
000720        "Value" of CmCheckPoHdFile = Pow-Tristate-Checked OR
000721        "Value" of CmCheckItrnFile = Pow-Tristate-Checked or
000722        "Value" of CmCheckOrdlFile = Pow-Tristate-Checked or
000723        "Value" of CmCheckStylFile = Pow-Tristate-Checked or
000724        "Value" of CmCheckMUCTFile = Pow-Tristate-Checked 
000725            SET Files-Selected-yes to True.
000726        
000727
000728     If Files-Selected-Yes
000729        Move Pow-True to "Enabled" OF ctPushConvert
000730     else
000731        Move Pow-False to "Enabled" OF ctPushConvert.
000732        
000733 END-PROGRAM.
000734     EXIT PROGRAM.
000735      
000736*</SCRIPT>
000737 END PROGRAM     ProcSetButtonConvert.
000738 IDENTIFICATION  DIVISION.
000739* ProcConvertStylF.
000740 PROGRAM-ID.     ProcConvertStylF IS COMMON.
000741*<SCRIPT DIVISION="PROCEDURE", NAME="ProcConvertStylF">
000742 ENVIRONMENT     DIVISION.
000743 INPUT-OUTPUT SECTION.
000744 FILE-CONTROL.
000745     COPY "STYLO.SL".
000746     COPY "STYLN.SL".
000747     
000748 DATA            DIVISION.
000749 FILE SECTION.
000750     COPY "STYLO.FD".
000751     COPY "STYLN.FD".
000752     
000753 WORKING-STORAGE SECTION.
000754     COPY "STYLN.DTA".
000755     COPY "STYLO.DTA".
000756
000757 01  Grid-Comment                 Pic x(150)          Value spaces.
000758 01  Grid-Filename                pic x(30)           Value spaces.
000759 01  Grid-Index                   Pic s9(9)  Comp-5   Value zero.
000760 
000761 01  REC-READ-CNT                 PIC S9(9)  COMP-5   VALUE ZERO.
000762 01  REC-WRITE-CNT                PIC S9(9)  COMP-5   VALUE ZERO.
000763 01  REC-ERROR-CNT                PIC S9(9)  COMP-5   VALUE ZERO.
000764 01  Ws-Error-Code                pic -9999           value zero.
000765
000766 01  Error-Line.
000767     05  Filler                   Pic X(12)  value "Write Error=".
000768     05  Dsp-Error-Code           Pic xx     value spaces.
000769     05  Filler                   Pic X(07)  value " Write:".
000770     05  Dsp-Error-Key            Pic x(30)  value spaces.
000771
000772 01  Counts-Line.
000773     05  Filler                   Pic X(05)  value "Read:".
000774     05  Dsp-Read-Cnt             Pic z,zzz,zz9 value zero.
000775     05  Filler                   Pic X(07)  value " Write:".
000776     05  Dsp-Write-Cnt            Pic z,zzz,zz9 value zero.
000777     05  Filler                   Pic X(08)  value " Errors:".
000778     05  Dsp-Error-Cnt            Pic z,zzz,zz9 value zero.
000779
000780 01  MSG-STYLE                    PIC S9(9)  COMP-5   Value Zero.
000781 
000782 01  WS-File-Exists-msg.
000783     05  Filler                   pic x(40) value "The new data file already Exists!".
000784     05  Filler                   Pic X     value x"0A".
000785     05  filler                   pic x(40) Value "Do you want to overwrite it?".
000786     
000787 01  WS-New-File-Error-msg.
000788     05  Filler                   pic x(40) value "The file to be converted has returned".
000789     05  Filler                   Pic X     value x"0A".
000790     05  Filler                   pic x(40) value " an error!".
000791     05  Filler                   Pic X     value x"0A".
000792     05  filler                   pic x(40) Value "File conversion aborted!".
000793     
000794 01  WS-Old-File-Error-msg.
000795     05  Old-File-Msg            pic x(40) value "The file to be converted was not found!".
000796     05  Filler                   Pic X     value x"0A".
000797     05  filler                   pic x(40) Value "File conversion aborted!".
000798     
000799 
000800 PROCEDURE       DIVISION.
000801 DECLARATIVES.
000802     COPY "STYLO.DS".
000803     COPY "STYLN.DS".
000804     GO TO STATUS-EXIT.
000805        
000806 STATUS-CHECK.
000807           IF FILE-STATUS = RECORD-LOCK OR DUPLICATE-RECORD
000808              or NO-FILE or STRUCTURE-MISMATCH or PERMANENT-ERROR
000809              GO TO STATUS-EXIT.
000810
000811           SET DBIO OF ERROR-KIND TO TRUE.
000812           MOVE FILE-NAME        TO ERROR-DBIO.
000813           MOVE FILE-STATUS      TO IOSTATUS OF ERROR-DBIO.
000814           MOVE "PROFITS.EXE"    TO ERROR-PROGRNAME.
000815           INVOKE POW-SELF "CallForm" USING "DBIOERROR" "ERRORBOX"
000816                 RETURNING ReturnValue.
000817           INVOKE POW-SELF "CloseForm" USING "ProfitsConversion"
000818                 RETURNING ReturnValue.
000819           EXIT PROGRAM.
000820           
000821 STATUS-EXIT. EXIT.       
000822 END DECLARATIVES. 
000823 BEGIN-PROGRAM.
000824     Move zero to Rec-Read-Cnt, Rec-Write-Cnt, Rec-Error-Cnt.
000825     MOVE "STYLOR.FIL"    TO STYLO--NAME.
000826     MOVE "STYLOR.V45"    TO STYLN--NAME.
000827     MOve zero to Msg-Style.
000828     
000829     PERFORM STRING-FILENAMES.
000830     Move Spaces to Grid-Comment.
000831     String "Working on: "          delimited by size
000832            STYLo-fullpath           delimited by space
000833            into Grid-Comment.
000834     Move Grid-Comment to "Caption" OF ctTextCurrStatus.
000835*     Move Pow-Color-Gray to "STYLBackColor"(grid-index) OF ctGridResults.
000836       
000837 CHECK-FOR-FILES.
000838     OPEN INPUT STYLN.
000839*-- If file does not exist, just continue on --*
000840     If STYLN-STATUS = NO-FILE
000841        NEXT SENTENCE
000842     ELSE
000843     If C-Found of STYLN-Status or STYLN-Status = "39"
000844*-- If file is found, ask user if it should be overwritten --*
000845        PERFORM NEW-FILE-ALREADY-EXISTS
000846        IF ReturnValue = Pow-DMRNo
000847           Move Zero   to Grid-Index
000848           MOVE "STYL" TO Grid-Filename
000849           Move spaces to Grid-Comment
000850           string STYLN-fullpath     delimited by space
000851                  " - Exists, Conversion Aborted by User." delimited by size
000852                  into Grid-Comment
000853           PERFORM ADD-GRID-LINE
000854           Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
000855         Add 1 to Conv-Error-Cnt
000856           Go to End-Program
000857        ELSE
000858           Move Zero   to Grid-Index
000859           MOVE "STYL" TO Grid-Filename
000860           Move spaces to Grid-Comment
000861           string STYLN-fullpath     delimited by space
000862                  " - File will be overwritten." delimited by size
000863                  into Grid-Comment
000864           PERFORM ADD-GRID-LINE
000865           Move Pow-Color-Yellow to "ItemBackColor"(grid-index) OF ctGridResults
000866     Else
000867         Perform New-File-Other-Error
000868         Move Spaces to Grid-Comment
000869         String STYLN-FullPath         delimited by spaces
000870                " - Error = "          delimited by size
000871                STYLN-Status           delimited by size
000872                into Grid-Comment
000873         Perform Add-Grid-Line
000874         Add 1 to Conv-Error-Cnt
000875         Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults.
000876         
000877                   
000878     OPEN INPUT STYLO.
000879*-- The file to be converted does not exist, Abort the conversion --*
000880     IF STYLO-STATUS = NO-FILe
000881        MOVE "The file to be converted was not found." TO OLD-FILE-MSG
000882        PERFORM OLD-FILE-ERROR-MSG
000883        Move Zero   to Grid-Index
000884        Move spaces to Grid-Comment
000885        string STYLO-fullpath     delimited by space
000886               " - Not Found, Conversion Aborted.    " delimited by size
000887               into Grid-Comment
000888        PERFORM ADD-GRID-LINE
000889        Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
000890         Add 1 to Conv-Error-Cnt
000891        Go to End-Program.
000892
000893*-- The file was found, but is not the correct starting layout (structure) --*
000894     IF STYLO-STATUS = STRUCTURE-MISMATCH
000895        MOVE "Wrong Starting version of this file." TO OLD-FILE-MSG
000896        PERFORM OLD-FILE-ERROR-MSG
000897        Move Zero   to Grid-Index
000898        Move spaces to Grid-Comment
000899        string STYLO-fullpath     delimited by space
000900               " - Wrong Starting Structure, Conversion Aborted.    " delimited by size
000901               into Grid-Comment
000902        PERFORM ADD-GRID-LINE
000903        Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
000904         Add 1 to Conv-Error-Cnt
000905        Go to End-Program.
000906    
000907*-- The file was found, but it appears to be corrupted --*
000908     IF STYLO-STATUS = PERMANENT-ERROR
000909        MOVE "The file seems to be corrupted." TO OLD-FILE-MSG
000910        PERFORM OLD-FILE-Error-Msg
000911        Move Zero   to Grid-Index
000912        Move spaces to Grid-Comment
000913        string STYLO-fullpath     delimited by space
000914               " - Corrupted, Try rebuilding it. Conversion Aborted.    " delimited by size
000915               into Grid-Comment
000916        PERFORM ADD-GRID-LINE
000917        Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
000918         Add 1 to Conv-Error-Cnt
000919        Go to End-Program.
000920
000921  
000922 File-Tests-Passed.                   
000923     Move Spaces to Grid-Comment.
000924     String "Converting - "          delimited by size
000925            STYLo-fullpath           delimited by space
000926            into Grid-Comment.
000927     perform Add-Grid-Line.
000928     Open Output STYLN.
000929     
000930 START-DATA-CONVERSION.
000931     PERFORM  PROCESS-RECORD UNTIL STYLO-STATUS NOT = FOUND.
000932     CLOSE STYLO, STYLN.
000933
000934 Update-Grid-With-Counts.
000935     Move Rec-Read-Cnt to Dsp-Read-Cnt.
000936     Move Rec-Write-Cnt to Dsp-Write-Cnt.
000937     Move Rec-Error-Cnt to Dsp-Error-Cnt.
000938     Move Counts-Line to Grid-Comment.
000939     Perform Add-Grid-Line.
000940       
000941 RENAME-FILES.
000942     If "Value" OF CmCheckSaveOrg = Pow-Tristate-Checked
000943        Perform Save-Original-File
000944        If Cbl_Status_Code not = Zero
000945           Move "STYL File Conversion Aborted" to Grid-Comment
000946           Perform ADD-GRID-LINE
000947           Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
000948         Add 1 to Conv-Error-Cnt
000949           Go To End-Program
000950        else
000951           Perform Delete-Original-File
000952           If Cbl_Status_Code not = Zero
000953              Move "Original File Delete Failed" to Grid-Comment
000954              Perform ADD-GRID-LINE
000955              Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
000956              Move "STYL File Conversion Aborted" to Grid-Comment
000957              Perform ADD-GRID-LINE
000958              Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
000959         Add 1 to Conv-Error-Cnt
000960              Go To End-Program
000961           else
000962              Next Sentence
000963     Else
000964        Perform Delete-Original-File
000965        If Cbl_Status_Code not = Zero
000966           Move "Original File Delete Failed" to Grid-Comment
000967           Perform ADD-GRID-LINE
000968           Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
000969           Move "STYL File Conversion Aborted" to Grid-Comment
000970           Perform ADD-GRID-LINE
000971           Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
000972         Add 1 to Conv-Error-Cnt
000973           Go To End-Program.
000974        
000975     Perform Rename-New-File.    
000976     IF CBL_STATUS_CODE NOT = ZERO
000977        Move "RENAME .V44 TO .FIL Failed" to Grid-Comment
000978        Perform ADD-GRID-LINE
000979        Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
000980        Move "STYL File Conversion Aborted" to Grid-Comment
000981        Perform ADD-GRID-LINE
000982        Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
000983         Add 1 to Conv-Error-Cnt
000984        Go To End-Program.
000985     
000986 FINISHED-CONVERSION.
000987        Move "STYL File Conversion Successful" to Grid-Comment.
000988        Perform ADD-GRID-LINE.
000989        Move Pow-Color-Green to "ItemBackColor"(grid-index) OF ctGridResults.
000990     
000991 END-PROGRAM.
000992     EXIT PROGRAM.     
000993
000994 SUBROUTINE SECTION.
000995 STRING-FILENAMES.     
000996       MOVE SPACES TO STYLO-FULLPATH.
000997       String  Profits-Programs-Loc   delimited by space
000998               "\"                    DELIMITED BY SIZE
000999               Profits-Data-Loc       delimited by space
001000               "\"                    DELIMITED BY SIZE
001001               STYLO--NAME            DELIMITED BY SPACE
001002               INTO STYLO-FULLPATH.
001003
001004       MOVE SPACES TO STYLN-FULLPATH.
001005       String  Profits-Programs-Loc   delimited by space
001006               "\"                    DELIMITED BY SIZE
001007               Profits-Data-Loc       delimited by space
001008               "\"                    DELIMITED BY SIZE
001009               STYLN--NAME             DELIMITED BY SPACE
001010               INTO STYLN-FULLPATH.
001011 ADD-GRID-LINE.
001012*     Move Pow-Color-Black to "ItemBackColor"(grid-index) OF ctGridResults.
001013     move zero to Grid-Index.
001014     INVOKE ctGridResults "InsertItem" USING Grid-Comment Grid-Index RETURNING ReturnValue.
001015
001016 New-File-Already-Exists.
001017      If C-found of STYLN-Status
001018         close STYLN.
001019      Move zero       to Msg-Style.
001020      Add Pow-DMYesNo to Msg-Style.
001021      Add Pow-DMIconQuestion to Msg-Style.
001022      INVOKE Pow-Self "DisplayMessage" 
001023             USING Ws-File-Exists-Msg
001024                   "Profits Warning"
001025                   msg-style
001026             RETURNING ReturnValue.
001027
001028 New-File-Other-Error.
001029      Move zero    to Msg-Style.
001030      Add Pow-DMOK to Msg-Style.
001031      Add Pow-DMIconExclamation to Msg-Style.
001032      INVOKE Pow-Self "DisplayMessage" 
001033             USING Ws-new-File-Error-Msg
001034                   "Profits Warning"
001035                   msg-style
001036             RETURNING ReturnValue.
001037
001038 OLD-File-Error-Msg.
001039      Move zero        to Msg-Style.
001040      Add Pow-DMOK     to Msg-Style.
001041      Add Pow-DMIconExclamation to Msg-Style.
001042      INVOKE Pow-Self "DisplayMessage" 
001043             USING Ws-Old-file-Error-msg
001044                   "Profits Warning"
001045                   msg-style
001046             RETURNING ReturnValue.
001047             
001048 PROCESS-RECORD.
001049         PERFORM READ-STYLO.
001050         IF C-FOUND OF STYLO-STATUS
001051            PERFORM MOVE-DATA
001052            PERFORM WRITE-STYLN.
001053
001054      MOVE STYLE-NUMBER OF STYLN-REC    TO "Caption" OF ctTextPKey.
001055      MOVE REC-READ-CNT                TO "Value" OF ctNEditReadCnt.
001056      MOVE REC-WRITE-CNT               TO "Value" OF ctNEditWriteCnt.
001057      MOVE REC-ERROR-CNT               TO "Value" OF ctNEditErrorCnt.
001058      MOVE Conv-ERROR-CNT              TO "Value" OF ctNEditConvCnt.
001059      INVOKE POW-SELF "Refresh".
001060
001061 MOVE-DATA.  
001062     MOVE STYLO-KEY                    TO STYLN-KEY.
001063     MOVE STYLO-DATA1                  TO STYLN-DATA1.
001064
001065
001066
001067 Save-Original-File.
001068      MOVE STYLO-FULLPATH  TO CBL_FROM_PATH, CBL_TO_PATH.
001069      INSPECT CBL_TO_PATH REPLACING FIRST ".FIL" BY ".ORG".
001070      CALL "CBL_COPY_FILE"
001071           USING CBL_FROM_PATH CBL_TO_PATH 
001072           RETURNING CBL_STATUS_CODE.
001073      IF CBL_STATUS_CODE NOT = ZERO
001074         MOVE CBL_STATUS_CODE TO WS-ERROR-CODE
001075         MOVE SPACES TO GRID-COMMENT
001076         STRING "Error = "         DELIMITED BY size
001077                WS-ERROR-CODE      DELIMITED BY SIZE
001078                " - Save Original Failed" delimited by size
001079                into Grid-Comment
001080         perform ADD-GRID-LINE
001081         Add 1 to Conv-Error-Cnt
001082         Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults.
001083      
001084 Delete-Original-File.
001085      MOVE STYLO-FULLPATH  TO CBL_FROM_PATH.
001086      Call "CBL_DELETE_FILE"
001087           using CBL_From_Path
001088           Returning CBL_Status_Code.
001089           
001090 Rename-New-File.
001091      MOVE STYLN-FULLPATH TO CBL_TO_PATH, CBL_FROM_PATH.
001092      INSPECT CBL_TO_PATH REPLACING FIRST ".V45" BY ".FIL".
001093      CALL "CBL_RENAME_FILE"
001094           USING CBL_FROM_PATH CBL_TO_PATH
001095           RETURNING CBL_STATUS_CODE.
001096          
001097      
001098 SUBROUTINE-EXIT. EXIT.     
001099 
001100  IN-OUT SECTION.
001101  START-STYLO.
001102     START STYLO KEY IS NOT < STYLO-KEY
001103         INVALID KEY MOVE STYLO-STATUS TO STYLO-STATUS.
001104         
001105  READ-STYLO.
001106     READ STYLO NEXT
001107         AT END MOVE AT-END TO STYLO-STATUS.
001108     IF C-FOUND OF STYLO-STATUS
001109        ADD 1 TO REC-READ-CNT. 
001110            
001111  WRITE-STYLN.
001112     WRITE STYLN-REC
001113         INVALID KEY MOVE STYLN-STATUS TO STYLN-STATUS.
001114     IF C-FOUND OF STYLN-STATUS
001115        ADD 1 TO REC-WRITE-CNT
001116     ELSE
001117        Move STYLN-Status to DSP-Error-Code
001118        move STYLN-Key    to Dsp-Error-Key
001119        move Error-Line to Grid-Comment
001120        Perform Add-Grid-Line
001121         Add 1 to Conv-Error-Cnt
001122        Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
001123        ADD 1 TO REC-ERROR-CNT.     
001124         
001125  IN-OUT-EXIT. EXIT.      
001126*</SCRIPT>
001127 END PROGRAM     ProcConvertStylF.
001128 IDENTIFICATION  DIVISION.
001129* ProcConvertOrdLF.
001130 PROGRAM-ID.     ProcConvertOrdLF IS COMMON.
001131*<SCRIPT DIVISION="PROCEDURE", NAME="ProcConvertOrdLF">
001132 ENVIRONMENT     DIVISION.
001133 INPUT-OUTPUT SECTION.
001134 FILE-CONTROL.
001135     COPY "ORDLO.SL".
001136     COPY "ORDLN.SL".
001137     
001138 DATA            DIVISION.
001139 FILE SECTION.
001140     COPY "ORDLO.FD".
001141     COPY "ORDLN.FD".
001142     
001143 WORKING-STORAGE SECTION.
001144     COPY "ORDLN.DTA".
001145     COPY "ORDLO.DTA".
001146
001147 01  Grid-Comment                 Pic x(150)          Value spaces.
001148 01  Grid-Filename                pic x(30)           Value spaces.
001149 01  Grid-Index                   Pic s9(9)  Comp-5   Value zero.
001150 
001151 01  REC-READ-CNT                 PIC S9(9)  COMP-5   VALUE ZERO.
001152 01  REC-WRITE-CNT                PIC S9(9)  COMP-5   VALUE ZERO.
001153 01  REC-ERROR-CNT                PIC S9(9)  COMP-5   VALUE ZERO.
001154 01  Ws-Error-Code                pic -9999           value zero.
001155 77  WHSE-NUMERIC                 PIC 9999            VALUE ZERO.
001156
001157 01  Error-Line.
001158     05  Filler                   Pic X(12)  value "Write Error=".
001159     05  Dsp-Error-Code           Pic xx     value spaces.
001160     05  Filler                   Pic X(07)  value " Write:".
001161     05  Dsp-Error-Key            Pic x(30)  value spaces.
001162
001163 01  Counts-Line.
001164     05  Filler                   Pic X(05)  value "Read:".
001165     05  Dsp-Read-Cnt             Pic z,zzz,zz9 value zero.
001166     05  Filler                   Pic X(07)  value " Write:".
001167     05  Dsp-Write-Cnt            Pic z,zzz,zz9 value zero.
001168     05  Filler                   Pic X(08)  value " Errors:".
001169     05  Dsp-Error-Cnt            Pic z,zzz,zz9 value zero.
001170
001171 01  MSG-STYLE                    PIC S9(9)  COMP-5   Value Zero.
001172 
001173 01  WS-File-Exists-msg.
001174     05  Filler                   pic x(40) value "The new data file already Exists!".
001175     05  Filler                   Pic X     value x"0A".
001176     05  filler                   pic x(40) Value "Do you want to overwrite it?".
001177     
001178 01  WS-New-File-Error-msg.
001179     05  Filler                   pic x(40) value "The file to be converted has returned".
001180     05  Filler                   Pic X     value x"0A".
001181     05  Filler                   pic x(40) value " an error!".
001182     05  Filler                   Pic X     value x"0A".
001183     05  filler                   pic x(40) Value "File conversion aborted!".
001184     
001185 01  WS-Old-File-Error-msg.
001186     05  Old-File-Msg            pic x(40) value "The file to be converted was not found!".
001187     05  Filler                   Pic X     value x"0A".
001188     05  filler                   pic x(40) Value "File conversion aborted!".
001189     
001190 
001191 PROCEDURE       DIVISION.
001192 DECLARATIVES.
001193     COPY "ORDLO.DS".
001194     COPY "ORDLN.DS".
001195     GO TO STATUS-EXIT.
001196        
001197 STATUS-CHECK.
001198           IF FILE-STATUS = RECORD-LOCK OR DUPLICATE-RECORD
001199              or NO-FILE or STRUCTURE-MISMATCH or PERMANENT-ERROR
001200              GO TO STATUS-EXIT.
001201
001202           SET DBIO OF ERROR-KIND TO TRUE.
001203           MOVE FILE-NAME        TO ERROR-DBIO.
001204           MOVE FILE-STATUS      TO IOSTATUS OF ERROR-DBIO.
001205           MOVE "PROFITS.EXE"    TO ERROR-PROGRNAME.
001206           INVOKE POW-SELF "CallForm" USING "DBIOERROR" "ERRORBOX"
001207                 RETURNING ReturnValue.
001208           INVOKE POW-SELF "CloseForm" USING "ProfitsConversion"
001209                 RETURNING ReturnValue.
001210           EXIT PROGRAM.
001211           
001212 STATUS-EXIT. EXIT.       
001213 END DECLARATIVES. 
001214 BEGIN-PROGRAM.
001215     Move zero to Rec-Read-Cnt, Rec-Write-Cnt, Rec-Error-Cnt.
001216     MOVE "ORDERL.FIL"    TO ORDLO--NAME.
001217     MOVE "ORDERL.V45"    TO ORDLN--NAME.
001218     MOve zero to Msg-Style.
001219     PERFORM CONVERT-FILE THRU CONVERT-FILE-EXIT
001220
001221     Move zero to Rec-Read-Cnt, Rec-Write-Cnt, Rec-Error-Cnt.
001222     MOVE "OPENLINE.FIL"    TO ORDLO--NAME.
001223     MOVE "OPENLINE.V45"    TO ORDLN--NAME.
001224     MOve zero to Msg-Style.
001225     PERFORM CONVERT-FILE THRU CONVERT-FILE-EXIT.
001226
001227     Move zero to Rec-Read-Cnt, Rec-Write-Cnt, Rec-Error-Cnt.
001228     MOVE "ORDHSTL.FIL"    TO ORDLO--NAME.
001229     MOVE "ORDHSTL.V45"    TO ORDLN--NAME.
001230     MOve zero to Msg-Style.
001231     PERFORM CONVERT-FILE THRU CONVERT-FILE-EXIT.
001232
001233     Move zero to Rec-Read-Cnt, Rec-Write-Cnt, Rec-Error-Cnt.
001234     MOVE "QUOTELIN.FIL"    TO ORDLO--NAME.
001235     MOVE "QUOTELIN.V45"    TO ORDLN--NAME.
001236     MOve zero to Msg-Style.
001237     PERFORM CONVERT-FILE THRU CONVERT-FILE-EXIT.
001238
001239     
001240 END-PROGRAM.
001241     EXIT PROGRAM.     
001242     
001243     
001244*/////////////////////////////////////////
001245 CONVERT-FILE SECTION.     
001246*/////////////////////////////////////////
001247 CONVERT-BEGIN.
001248     PERFORM STRING-FILENAMES.
001249     Move Spaces to Grid-Comment.
001250     String "Working on: "          delimited by size
001251            ORDLo-fullpath           delimited by space
001252            into Grid-Comment.
001253     Move Grid-Comment to "Caption" OF ctTextCurrStatus.
001254*     Move Pow-Color-Gray to "ItemBackColor"(grid-index) OF ctGridResults.
001255       
001256 CHECK-FOR-FILES.
001257     OPEN INPUT ORDLN.
001258*-- If file does not exist, just continue on --*
001259     If ORDLN-STATUS = NO-FILE
001260        NEXT SENTENCE
001261     ELSE
001262     If C-Found of ORDLN-Status or ORDLN-Status = "39"
001263*-- If file is found, ask user if it should be overwritten --*
001264        PERFORM NEW-FILE-ALREADY-EXISTS
001265        IF ReturnValue = Pow-DMRNo
001266           Move Zero   to Grid-Index
001267           MOVE "ORDL" TO Grid-Filename
001268           Move spaces to Grid-Comment
001269           string ORDLN-fullpath     delimited by space
001270                  " - Exists, Conversion Aborted by User." delimited by size
001271                  into Grid-Comment
001272           PERFORM ADD-GRID-LINE
001273         Add 1 to Conv-Error-Cnt
001274           Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
001275           Go to CONVERT-FILE-EXIT
001276        ELSE
001277           Move Zero   to Grid-Index
001278           MOVE "ORDL" TO Grid-Filename
001279           Move spaces to Grid-Comment
001280           string ORDLN-fullpath     delimited by space
001281                  " - File will be overwritten." delimited by size
001282                  into Grid-Comment
001283           PERFORM ADD-GRID-LINE
001284           Move Pow-Color-Yellow to "ItemBackColor"(grid-index) OF ctGridResults
001285     Else
001286         Perform New-File-Other-Error
001287         Move Spaces to Grid-Comment
001288         String ORDLN-FullPath         delimited by spaces
001289                " - Error = "          delimited by size
001290                ORDLN-Status           delimited by size
001291                into Grid-Comment
001292         Perform Add-Grid-Line
001293         Add 1 to Conv-Error-Cnt
001294         Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults.
001295         
001296                   
001297     OPEN INPUT ORDLO.
001298*-- The file to be converted does not exist, Abort the conversion --*
001299     IF ORDLO-STATUS = NO-FILe
001300        MOVE "The file to be converted was not found." TO OLD-FILE-MSG
001301        PERFORM OLD-FILE-ERROR-MSG
001302        Move Zero   to Grid-Index
001303        Move spaces to Grid-Comment
001304        string ORDLO-fullpath     delimited by space
001305               " - Not Found, Conversion Aborted.    " delimited by size
001306               into Grid-Comment
001307        PERFORM ADD-GRID-LINE
001308         Add 1 to Conv-Error-Cnt
001309        Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
001310        Go to CONVERT-FILE-EXIT.
001311
001312*-- The file was found, but is not the correct starting layout (structure) --*
001313     IF ORDLO-STATUS = STRUCTURE-MISMATCH
001314        MOVE "Wrong Starting version of this file." TO OLD-FILE-MSG
001315        PERFORM OLD-FILE-ERROR-MSG
001316        Move Zero   to Grid-Index
001317        Move spaces to Grid-Comment
001318        string ORDLO-fullpath     delimited by space
001319               " - Wrong Starting Structure, Conversion Aborted.    " delimited by size
001320               into Grid-Comment
001321        PERFORM ADD-GRID-LINE
001322         Add 1 to Conv-Error-Cnt
001323        Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
001324        Go to CONVERT-FILE-EXIT.
001325    
001326*-- The file was found, but it appears to be corrupted --*
001327     IF ORDLO-STATUS = PERMANENT-ERROR
001328        MOVE "The file seems to be corrupted." TO OLD-FILE-MSG
001329        PERFORM OLD-FILE-Error-Msg
001330        Move Zero   to Grid-Index
001331        Move spaces to Grid-Comment
001332        string ORDLO-fullpath     delimited by space
001333               " - Corrupted, Try rebuilding it. Conversion Aborted.    " delimited by size
001334               into Grid-Comment
001335         Add 1 to Conv-Error-Cnt
001336        PERFORM ADD-GRID-LINE
001337        Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
001338        Go to CONVERT-FILE-EXIT.
001339
001340  
001341 File-Tests-Passed.                   
001342     Move Spaces to Grid-Comment.
001343     String "Converting - "          delimited by size
001344            ORDLo-fullpath           delimited by space
001345            into Grid-Comment.
001346     perform Add-Grid-Line.
001347     Open Output ORDLN.
001348     
001349 START-DATA-CONVERSION.
001350     PERFORM  PROCESS-RECORD UNTIL ORDLO-STATUS NOT = FOUND.
001351     CLOSE ORDLO, ORDLN.
001352
001353 Update-Grid-With-Counts.
001354     Move Rec-Read-Cnt to Dsp-Read-Cnt.
001355     Move Rec-Write-Cnt to Dsp-Write-Cnt.
001356     Move Rec-Error-Cnt to Dsp-Error-Cnt.
001357     Move Counts-Line to Grid-Comment.
001358     Perform Add-Grid-Line.
001359       
001360 RENAME-FILES.
001361     If "Value" OF CmCheckSaveOrg = Pow-Tristate-Checked
001362        Perform Save-Original-File
001363        If Cbl_Status_Code not = Zero
001364           Move "ORDL File Conversion Aborted" to Grid-Comment
001365           Perform ADD-GRID-LINE
001366           Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
001367         Add 1 to Conv-Error-Cnt
001368           Go To CONVERT-FILE-EXIT
001369        else
001370           Perform Delete-Original-File
001371           If Cbl_Status_Code not = Zero
001372              Move "Original File Delete Failed" to Grid-Comment
001373              Perform ADD-GRID-LINE
001374              Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
001375              Move "ORDL File Conversion Aborted" to Grid-Comment
001376              Perform ADD-GRID-LINE
001377              Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
001378         Add 1 to Conv-Error-Cnt
001379              Go To CONVERT-FILE-EXIT
001380           else
001381              Next Sentence
001382     Else
001383        Perform Delete-Original-File
001384        If Cbl_Status_Code not = Zero
001385           Move "Original File Delete Failed" to Grid-Comment
001386           Perform ADD-GRID-LINE
001387           Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
001388           Move "ORDL File Conversion Aborted" to Grid-Comment
001389           Perform ADD-GRID-LINE
001390         Add 1 to Conv-Error-Cnt
001391           Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
001392           Go To CONVERT-FILE-EXIT.
001393        
001394     Perform Rename-New-File.    
001395     IF CBL_STATUS_CODE NOT = ZERO
001396        Move "RENAME .V44 TO .FIL Failed" to Grid-Comment
001397        Perform ADD-GRID-LINE
001398        Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
001399        Move "ORDL File Conversion Aborted" to Grid-Comment
001400        Perform ADD-GRID-LINE
001401         Add 1 to Conv-Error-Cnt
001402        Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
001403        Go To CONVERT-FILE-EXIT.
001404     
001405 FINISHED-CONVERSION.
001406        Move "ORDL File Conversion Successful" to Grid-Comment.
001407        Perform ADD-GRID-LINE.
001408        Move Pow-Color-Green to "ItemBackColor"(grid-index) OF ctGridResults.
001409     
001410 CONVERT-FILE-EXIT. EXIT.
001411 
001412 SUBROUTINE SECTION.
001413 STRING-FILENAMES.     
001414       MOVE SPACES TO ORDLO-FULLPATH.
001415       String  Profits-Programs-Loc   delimited by space
001416               "\"                    DELIMITED BY SIZE
001417               Profits-Data-Loc       delimited by space
001418               "\"                    DELIMITED BY SIZE
001419               ORDLO--NAME            DELIMITED BY SPACE
001420               INTO ORDLO-FULLPATH.
001421
001422       MOVE SPACES TO ORDLN-FULLPATH.
001423       String  Profits-Programs-Loc   delimited by space
001424               "\"                    DELIMITED BY SIZE
001425               Profits-Data-Loc       delimited by space
001426               "\"                    DELIMITED BY SIZE
001427               ORDLN--NAME             DELIMITED BY SPACE
001428               INTO ORDLN-FULLPATH.
001429 ADD-GRID-LINE.
001430*     Move Pow-Color-Black to "ItemBackColor"(grid-index) OF ctGridResults.
001431     move zero to Grid-Index.
001432     INVOKE ctGridResults "InsertItem" USING Grid-Comment Grid-Index RETURNING ReturnValue.
001433
001434 New-File-Already-Exists.
001435      If C-found of ORDLN-Status
001436         close ORDLN.
001437      Move zero       to Msg-Style.
001438      Add Pow-DMYesNo to Msg-Style.
001439      Add Pow-DMIconQuestion to Msg-Style.
001440      INVOKE Pow-Self "DisplayMessage" 
001441             USING Ws-File-Exists-Msg
001442                   "Profits Warning"
001443                   msg-style
001444             RETURNING ReturnValue.
001445
001446 New-File-Other-Error.
001447      Move zero    to Msg-Style.
001448      Add Pow-DMOK to Msg-Style.
001449      Add Pow-DMIconExclamation to Msg-Style.
001450      INVOKE Pow-Self "DisplayMessage" 
001451             USING Ws-new-File-Error-Msg
001452                   "Profits Warning"
001453                   msg-style
001454             RETURNING ReturnValue.
001455
001456 OLD-File-Error-Msg.
001457      Move zero        to Msg-Style.
001458      Add Pow-DMOK     to Msg-Style.
001459      Add Pow-DMIconExclamation to Msg-Style.
001460      INVOKE Pow-Self "DisplayMessage" 
001461             USING Ws-Old-file-Error-msg
001462                   "Profits Warning"
001463                   msg-style
001464             RETURNING ReturnValue.
001465             
001466 PROCESS-RECORD.
001467         PERFORM READ-ORDLO.
001468         IF C-FOUND OF ORDLO-STATUS
001469            PERFORM MOVE-DATA
001470            PERFORM WRITE-ORDLN.
001471
001472      MOVE ORDLN-KEY    OF ORDLN-REC   TO "Caption" OF ctTextPKey.
001473      MOVE REC-READ-CNT                TO "Value" OF ctNEditReadCnt.
001474      MOVE REC-WRITE-CNT               TO "Value" OF ctNEditWriteCnt.
001475      MOVE REC-ERROR-CNT               TO "Value" OF ctNEditErrorCnt.
001476      MOVE Conv-ERROR-CNT              TO "Value" OF ctNEditConvCnt.
001477      INVOKE POW-SELF "Refresh".
001478
001479 MOVE-DATA.  
001480      MOVE ORDLO-KEY    OF ORDLO-REC    TO ORDLN-KEY    OF ORDLN-REC.
001481
001482 Save-Original-File.
001483      MOVE ORDLO-FULLPATH  TO CBL_FROM_PATH, CBL_TO_PATH.
001484      INSPECT CBL_TO_PATH REPLACING FIRST ".FIL" BY ".ORG".
001485      CALL "CBL_COPY_FILE"
001486           USING CBL_FROM_PATH CBL_TO_PATH 
001487           RETURNING CBL_STATUS_CODE.
001488      IF CBL_STATUS_CODE NOT = ZERO
001489         MOVE CBL_STATUS_CODE TO WS-ERROR-CODE
001490         MOVE SPACES TO GRID-COMMENT
001491         STRING "Error = "         DELIMITED BY size
001492                WS-ERROR-CODE      DELIMITED BY SIZE
001493                " - Save Original Failed" delimited by size
001494                into Grid-Comment
001495         perform ADD-GRID-LINE
001496         Add 1 to Conv-Error-Cnt
001497         Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults.
001498      
001499 Delete-Original-File.
001500      MOVE ORDLO-FULLPATH  TO CBL_FROM_PATH.
001501      Call "CBL_DELETE_FILE"
001502           using CBL_From_Path
001503           Returning CBL_Status_Code.
001504           
001505 Rename-New-File.
001506      MOVE ORDLN-FULLPATH TO CBL_TO_PATH, CBL_FROM_PATH.
001507      INSPECT CBL_TO_PATH REPLACING FIRST ".V45" BY ".FIL".
001508      CALL "CBL_RENAME_FILE"
001509           USING CBL_FROM_PATH CBL_TO_PATH
001510           RETURNING CBL_STATUS_CODE.
001511          
001512      
001513 SUBROUTINE-EXIT. EXIT.     
001514 
001515  IN-OUT SECTION.
001516  START-ORDLO.
001517     START ORDLO KEY IS NOT < ORDLO-KEY
001518         INVALID KEY MOVE ORDLO-STATUS TO ORDLO-STATUS.
001519         
001520  READ-ORDLO.
001521     READ ORDLO NEXT
001522         AT END MOVE AT-END TO ORDLO-STATUS.
001523     IF C-FOUND OF ORDLO-STATUS
001524        ADD 1 TO REC-READ-CNT. 
001525            
001526  WRITE-ORDLN.
001527     WRITE ORDLN-REC
001528         INVALID KEY MOVE ORDLN-STATUS TO ORDLN-STATUS.
001529     IF C-FOUND OF ORDLN-STATUS
001530        ADD 1 TO REC-WRITE-CNT
001531     ELSE
001532        Move ORDLN-Status      to DSP-Error-Code
001533        move ORDLO-KEY         to Dsp-Error-Key
001534        move Error-Line        to Grid-Comment
001535        Perform Add-Grid-Line
001536         Add 1 to Conv-Error-Cnt
001537        Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
001538        ADD 1 TO REC-ERROR-CNT.     
001539         
001540  IN-OUT-EXIT. EXIT.  
001541*</SCRIPT>
001542 END PROGRAM     ProcConvertOrdLF.
001543 IDENTIFICATION  DIVISION.
001544* ProcConvertItrnF.
001545 PROGRAM-ID.     ProcConvertItrnF IS COMMON.
001546*<SCRIPT DIVISION="PROCEDURE", NAME="ProcConvertItrnF">
001547 ENVIRONMENT     DIVISION.
001548 INPUT-OUTPUT SECTION.
001549 FILE-CONTROL.
001550     COPY "ITRNO.SL".
001551     COPY "ITRNN.SL".
001552     
001553 DATA            DIVISION.
001554 FILE SECTION.
001555     COPY "ITRNO.FD".
001556     COPY "ITRNN.FD".
001557     
001558 WORKING-STORAGE SECTION.
001559     COPY "ITRNN.DTA".
001560     COPY "ITRNO.DTA".
001561 01  WS-ITRN-NAME.
001562     05  FILLER                   PIC X(04)           VALUE "ITRN".
001563     05  WS-ITRN-STATION          PIC 9(3)            VALUE ZERO.
001564     05  FILLER                   PIC X(04)           VALUE ".FIL".
001565
001566  01  Grid-Comment                 Pic x(150)          Value spaces.
001567 01  Grid-Filename                pic x(30)           Value spaces.
001568 01  Grid-Index                   Pic s9(9)  Comp-5   Value zero.
001569 
001570 01  REC-READ-CNT                 PIC S9(9)  COMP-5   VALUE ZERO.
001571 01  REC-WRITE-CNT                PIC S9(9)  COMP-5   VALUE ZERO.
001572 01  REC-ERROR-CNT                PIC S9(9)  COMP-5   VALUE ZERO.
001573 01  Ws-Error-Code                pic -9999           value zero.
001574 77  WHSE-NUMERIC                 PIC 9999            VALUE ZERO.
001575
001576 01  Error-Line.
001577     05  Filler                   Pic X(12)  value "Write Error=".
001578     05  Dsp-Error-Code           Pic xx     value spaces.
001579     05  Filler                   Pic X(07)  value " Write:".
001580     05  Dsp-Error-Key            Pic x(30)  value spaces.
001581
001582 01  Counts-Line.
001583     05  Filler                   Pic X(05)  value "Read:".
001584     05  Dsp-Read-Cnt             Pic z,zzz,zz9 value zero.
001585     05  Filler                   Pic X(07)  value " Write:".
001586     05  Dsp-Write-Cnt            Pic z,zzz,zz9 value zero.
001587     05  Filler                   Pic X(08)  value " Errors:".
001588     05  Dsp-Error-Cnt            Pic z,zzz,zz9 value zero.
001589
001590 01  MSG-STYLE                    PIC S9(9)  COMP-5   Value Zero.
001591 
001592 01  WS-File-Exists-msg.
001593     05  Filler                   pic x(40) value "The new data file already Exists!".
001594     05  Filler                   Pic X     value x"0A".
001595     05  filler                   pic x(40) Value "Do you want to overwrite it?".
001596     
001597 01  WS-New-File-Error-msg.
001598     05  Filler                   pic x(40) value "The file to be converted has returned".
001599     05  Filler                   Pic X     value x"0A".
001600     05  Filler                   pic x(40) value " an error!".
001601     05  Filler                   Pic X     value x"0A".
001602     05  filler                   pic x(40) Value "File conversion aborted!".
001603     
001604 01  WS-Old-File-Error-msg.
001605     05  Old-File-Msg            pic x(40) value "The file to be converted was not found!".
001606     05  Filler                   Pic X     value x"0A".
001607     05  filler                   pic x(40) Value "File conversion aborted!".
001608     
001609 
001610 PROCEDURE       DIVISION.
001611 DECLARATIVES.
001612     COPY "ITRNO.DS".
001613     COPY "ITRNN.DS".
001614     GO TO STATUS-EXIT.
001615        
001616 STATUS-CHECK.
001617           IF FILE-STATUS = RECORD-LOCK OR DUPLICATE-RECORD
001618              or NO-FILE or STRUCTURE-MISMATCH or PERMANENT-ERROR
001619              GO TO STATUS-EXIT.
001620
001621           SET DBIO OF ERROR-KIND TO TRUE.
001622           MOVE FILE-NAME        TO ERROR-DBIO.
001623           MOVE FILE-STATUS      TO IOSTATUS OF ERROR-DBIO.
001624           MOVE "PROFITS.EXE"    TO ERROR-PROGRNAME.
001625           INVOKE POW-SELF "CallForm" USING "DBIOERROR" "ERRORBOX"
001626                 RETURNING ReturnValue.
001627           INVOKE POW-SELF "CloseForm" USING "ProfitsConversion"
001628                 RETURNING ReturnValue.
001629           EXIT PROGRAM.
001630           
001631 STATUS-EXIT. EXIT.       
001632 END DECLARATIVES. 
001633 BEGIN-PROGRAM.
001634*     MOVE "INVTRAN.FIL"    TO ITRNO--NAME.
001635*     MOVE "INVTRAN.V44"    TO ITRNN--NAME.
001636     Perform Find-Files varying WS-ITRN-STATION from 1 by 1 until 
001637             WS-ITRN-STATION > 200.
001638
001639*     Move zero to Rec-Read-Cnt, Rec-Write-Cnt, Rec-Error-Cnt.
001640*     MOVE "ITRNTEMP.FIL"    TO ITRNO--NAME.
001641*     MOVE "ITRNTEMP.V44"    TO ITRNN--NAME.
001642*     MOve zero to Msg-Style.
001643*     PERFORM CONVERT-FILE THRU CONVERT-FILE-EXIT.
001644
001645     
001646 END-PROGRAM.
001647     EXIT PROGRAM.     
001648     
001649     
001650*/////////////////////////////////////////
001651 CONVERT-FILE SECTION.     
001652*/////////////////////////////////////////
001653 CONVERT-BEGIN.
001654     MOVE ZERO TO ITRNN-KEY, ITRNO-KEY.
001655     Move zero to Rec-Read-Cnt, Rec-Write-Cnt, Rec-Error-Cnt.
001656     MOve zero to Msg-Style.
001657     PERFORM STRING-FILENAMES.
001658     Move Spaces to Grid-Comment.
001659     String "Working on: "          delimited by size
001660            ITRNo-fullpath           delimited by space
001661            into Grid-Comment.
001662     Move Grid-Comment to "Caption" OF ctTextCurrStatus.
001663*     Move Pow-Color-Gray to "ItemBackColor"(grid-index) OF ctGridResults.
001664       
001665 CHECK-FOR-FILES.
001666     OPEN INPUT ITRNN.
001667*-- If file does not exist, just continue on --*
001668     If ITRNN-STATUS = NO-FILE
001669        NEXT SENTENCE
001670     ELSE
001671     If C-Found of ITRNN-Status or ITRNN-Status = "39"
001672*-- If file is found, ask user if it should be overwritten --*
001673        PERFORM NEW-FILE-ALREADY-EXISTS
001674        IF ReturnValue = Pow-DMRNo
001675           Move Zero   to Grid-Index
001676           MOVE "ITRN" TO Grid-Filename
001677           Move spaces to Grid-Comment
001678           string ITRNN-fullpath     delimited by space
001679                  " - Exists, Conversion Aborted by User." delimited by size
001680                  into Grid-Comment
001681           PERFORM ADD-GRID-LINE
001682         Add 1 to Conv-Error-Cnt
001683           Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
001684           Go to CONVERT-FILE-EXIT
001685        ELSE
001686           Move Zero   to Grid-Index
001687           MOVE "ITRN" TO Grid-Filename
001688           Move spaces to Grid-Comment
001689           string ITRNN-fullpath     delimited by space
001690                  " - File will be overwritten." delimited by size
001691                  into Grid-Comment
001692           PERFORM ADD-GRID-LINE
001693           Move Pow-Color-Yellow to "ItemBackColor"(grid-index) OF ctGridResults
001694     Else
001695         Perform New-File-Other-Error
001696         Move Spaces to Grid-Comment
001697         String ITRNN-FullPath         delimited by spaces
001698                " - Error = "          delimited by size
001699                ITRNN-Status           delimited by size
001700                into Grid-Comment
001701         Perform Add-Grid-Line
001702         Add 1 to Conv-Error-Cnt
001703         Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults.
001704         
001705                   
001706     OPEN INPUT ITRNO.
001707*-- The file to be converted does not exist, Abort the conversion --*
001708     IF ITRNO-STATUS = NO-FILe
001709        MOVE "The file to be converted was not found." TO OLD-FILE-MSG
001710        PERFORM OLD-FILE-ERROR-MSG
001711        Move Zero   to Grid-Index
001712        Move spaces to Grid-Comment
001713        string ITRNO-fullpath     delimited by space
001714               " - Not Found, Conversion Aborted.    " delimited by size
001715               into Grid-Comment
001716        PERFORM ADD-GRID-LINE
001717        Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
001718         Add 1 to Conv-Error-Cnt
001719        Go to CONVERT-FILE-EXIT.
001720
001721*-- The file was found, but is not the correct starting layout (structure) --*
001722     IF ITRNO-STATUS = STRUCTURE-MISMATCH
001723        MOVE "Wrong Starting version of this file." TO OLD-FILE-MSG
001724        PERFORM OLD-FILE-ERROR-MSG
001725        Move Zero   to Grid-Index
001726        Move spaces to Grid-Comment
001727        string ITRNO-fullpath     delimited by space
001728               " - Wrong Starting Structure, File Skipped.    " delimited by size
001729               into Grid-Comment
001730         PERFORM ADD-GRID-LINE
001731         PERFORM SAVE-ORIGINAL-FILE
001732         PERFORM DELETE-ORIGINAL-FILE
001733         Add 1 to Conv-Error-Cnt
001734        Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
001735        Go to CONVERT-FILE-EXIT.
001736    
001737*-- The file was found, but it appears to be corrupted --*
001738     IF ITRNO-STATUS = PERMANENT-ERROR
001739        MOVE "The file seems to be corrupted." TO OLD-FILE-MSG
001740        PERFORM OLD-FILE-Error-Msg
001741        Move Zero   to Grid-Index
001742        Move spaces to Grid-Comment
001743        string ITRNO-fullpath     delimited by space
001744               " - Corrupted, Try rebuilding it. Conversion Aborted.    " delimited by size
001745               into Grid-Comment
001746        PERFORM ADD-GRID-LINE
001747         Add 1 to Conv-Error-Cnt
001748        Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
001749        Go to CONVERT-FILE-EXIT.
001750
001751  
001752 File-Tests-Passed.                   
001753     Move Spaces to Grid-Comment.
001754     String "Converting - "          delimited by size
001755            ITRNo-fullpath           delimited by space
001756            into Grid-Comment.
001757     perform Add-Grid-Line.
001758     Open Output ITRNN.
001759     
001760 START-DATA-CONVERSION.
001761     PERFORM  PROCESS-RECORD UNTIL ITRNO-STATUS NOT = FOUND.
001762     CLOSE ITRNO, ITRNN.
001763
001764 Update-Grid-With-Counts.
001765     Move Rec-Read-Cnt to Dsp-Read-Cnt.
001766     Move Rec-Write-Cnt to Dsp-Write-Cnt.
001767     Move Rec-Error-Cnt to Dsp-Error-Cnt.
001768     Move Counts-Line to Grid-Comment.
001769     Perform Add-Grid-Line.
001770       
001771 RENAME-FILES.
001772     If "Value" OF CmCheckSaveOrg = Pow-Tristate-Checked
001773        Perform Save-Original-File
001774        If Cbl_Status_Code not = Zero
001775           Move "ITRN File Conversion Aborted" to Grid-Comment
001776           Perform ADD-GRID-LINE
001777           Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
001778         Add 1 to Conv-Error-Cnt
001779           Go To CONVERT-FILE-EXIT
001780        else
001781           Perform Delete-Original-File
001782           If Cbl_Status_Code not = Zero
001783              Move "Original File Delete Failed" to Grid-Comment
001784              Perform ADD-GRID-LINE
001785              Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
001786              Move "ITRN File Conversion Aborted" to Grid-Comment
001787              Perform ADD-GRID-LINE
001788              Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
001789         Add 1 to Conv-Error-Cnt
001790              Go To CONVERT-FILE-EXIT
001791           else
001792              Next Sentence
001793     Else
001794        Perform Delete-Original-File
001795        If Cbl_Status_Code not = Zero
001796           Move "Original File Delete Failed" to Grid-Comment
001797           Perform ADD-GRID-LINE
001798           Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
001799           Move "ITRN File Conversion Aborted" to Grid-Comment
001800           Perform ADD-GRID-LINE
001801           Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
001802         Add 1 to Conv-Error-Cnt
001803           Go To CONVERT-FILE-EXIT.
001804        
001805     Perform Rename-New-File.    
001806     IF CBL_STATUS_CODE NOT = ZERO
001807        Move "RENAME .V44 TO .FIL Failed" to Grid-Comment
001808        Perform ADD-GRID-LINE
001809        Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
001810        Move "ITRN File Conversion Aborted" to Grid-Comment
001811        Perform ADD-GRID-LINE
001812        Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
001813         Add 1 to Conv-Error-Cnt
001814        Go To CONVERT-FILE-EXIT.
001815     
001816 FINISHED-CONVERSION.
001817        Move "ITRN File Conversion Successful" to Grid-Comment.
001818        Perform ADD-GRID-LINE.
001819        Move Pow-Color-Green to "ItemBackColor"(grid-index) OF ctGridResults.
001820     
001821 CONVERT-FILE-EXIT. EXIT.
001822 
001823 SUBROUTINE SECTION.
001824 Find-Files.
001825     Move WS-ITRN-NAME  TO ITRNO--NAME, ITRNN--NAME.
001826     INSPECT ITRNN--NAME REPLACING FIRST ".FIL" BY ".V44".
001827     PERFORM STRING-FILENAMES.
001828     MOVE ITRNO-FULLPATH TO CBL_FILE_PATH.
001829     CALL "CBL_CHECK_FILE_EXIST" 
001830          USING  CBL_FILE_PATH
001831                 CBL_FILE_DETAILS
001832          RETURNING  CBL_STATUS_CODE.
001833     IF CBL_STATUS_CODE = 0
001834        PERFORM CONVERT-FILE THRU CONVERT-FILE-EXIT.
001835
001836 STRING-FILENAMES.     
001837       MOVE SPACES TO ITRNO-FULLPATH.
001838       String  Profits-Programs-Loc   delimited by space
001839               "\"                    DELIMITED BY SIZE
001840               Profits-Data-Loc       delimited by space
001841               "\"                    DELIMITED BY SIZE
001842               ITRNO--NAME            DELIMITED BY SPACE
001843               INTO ITRNO-FULLPATH.
001844
001845       MOVE SPACES TO ITRNN-FULLPATH.
001846       String  Profits-Programs-Loc   delimited by space
001847               "\"                    DELIMITED BY SIZE
001848               Profits-Data-Loc       delimited by space
001849               "\"                    DELIMITED BY SIZE
001850               ITRNN--NAME             DELIMITED BY SPACE
001851               INTO ITRNN-FULLPATH.
001852 ADD-GRID-LINE.
001853*     Move Pow-Color-Black to "ItemBackColor"(grid-index) OF ctGridResults.
001854     move zero to Grid-Index.
001855     INVOKE ctGridResults "InsertItem" USING Grid-Comment Grid-Index RETURNING ReturnValue.
001856
001857 New-File-Already-Exists.
001858      If C-found of ITRNN-Status
001859         close ITRNN.
001860      Move zero       to Msg-Style.
001861      Add Pow-DMYesNo to Msg-Style.
001862      Add Pow-DMIconQuestion to Msg-Style.
001863      INVOKE Pow-Self "DisplayMessage" 
001864             USING Ws-File-Exists-Msg
001865                   "Profits Warning"
001866                   msg-style
001867             RETURNING ReturnValue.
001868
001869 New-File-Other-Error.
001870      Move zero    to Msg-Style.
001871      Add Pow-DMOK to Msg-Style.
001872      Add Pow-DMIconExclamation to Msg-Style.
001873      INVOKE Pow-Self "DisplayMessage" 
001874             USING Ws-new-File-Error-Msg
001875                   "Profits Warning"
001876                   msg-style
001877             RETURNING ReturnValue.
001878
001879 OLD-File-Error-Msg.
001880      Move zero        to Msg-Style.
001881      Add Pow-DMOK     to Msg-Style.
001882      Add Pow-DMIconExclamation to Msg-Style.
001883      INVOKE Pow-Self "DisplayMessage" 
001884             USING Ws-Old-file-Error-msg
001885                   "Profits Warning"
001886                   msg-style
001887             RETURNING ReturnValue.
001888             
001889 PROCESS-RECORD.
001890     PERFORM READ-ITRNO.
001891     IF C-FOUND OF ITRNO-STATUS
001892        PERFORM MOVE-DATA
001893        PERFORM WRITE-ITRNN.
001894     MOVE ITRN-ITEM-NO OF ITRNN-REC   TO "Caption" OF ctTextPKey.
001895     MOVE REC-READ-CNT                TO "Value" OF ctNEditReadCnt.
001896     MOVE REC-WRITE-CNT               TO "Value" OF ctNEditWriteCnt.
001897     MOVE REC-ERROR-CNT               TO "Value" OF ctNEditErrorCnt.
001898     MOVE Conv-ERROR-CNT              TO "Value" OF ctNEditConvCnt.
001899     INVOKE POW-SELF "Refresh".
001900
001901 MOVE-DATA.  
001902     MOVE ITRNO-REC         TO ITRNN-REC.
001903     MOVE SPACES            TO ITRN-ROLL-NUMBER OF ITRNN-REC.
001904     MOVE ZERO              TO ITRN-ORDER-NO    OF ITRNN-REC
001905                               ITRN-SUB-ORDER-NO OF ITRNN-REC
001906                               ITRN-SEQ-NO       OF ITRNN-REC.
001907               
001908
001909 Save-Original-File.
001910      MOVE ITRNO-FULLPATH  TO CBL_FROM_PATH, CBL_TO_PATH.
001911      INSPECT CBL_TO_PATH REPLACING FIRST ".FIL" BY ".ORG".
001912      CALL "CBL_COPY_FILE"
001913           USING CBL_FROM_PATH CBL_TO_PATH 
001914           RETURNING CBL_STATUS_CODE.
001915      IF CBL_STATUS_CODE NOT = ZERO
001916         MOVE CBL_STATUS_CODE TO WS-ERROR-CODE
001917         MOVE SPACES TO GRID-COMMENT
001918         STRING "Error = "         DELIMITED BY size
001919                WS-ERROR-CODE      DELIMITED BY SIZE
001920                " - Save Original Failed" delimited by size
001921                into Grid-Comment
001922         perform ADD-GRID-LINE
001923         Add 1 to Conv-Error-Cnt
001924         Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults.
001925      
001926 Delete-Original-File.
001927      MOVE ITRNO-FULLPATH  TO CBL_FROM_PATH.
001928      Call "CBL_DELETE_FILE"
001929           using CBL_From_Path
001930           Returning CBL_Status_Code.
001931           
001932 Rename-New-File.
001933      MOVE ITRNN-FULLPATH TO CBL_TO_PATH, CBL_FROM_PATH.
001934      INSPECT CBL_TO_PATH REPLACING FIRST ".V44" BY ".FIL".
001935      CALL "CBL_RENAME_FILE"
001936           USING CBL_FROM_PATH CBL_TO_PATH
001937           RETURNING CBL_STATUS_CODE.
001938          
001939      
001940 SUBROUTINE-EXIT. EXIT.     
001941 
001942  IN-OUT SECTION.
001943  START-ITRNO.
001944     START ITRNO KEY IS NOT < ITRNO-KEY
001945         INVALID KEY MOVE ITRNO-STATUS TO ITRNO-STATUS.
001946         
001947  READ-ITRNO.
001948     READ ITRNO NEXT
001949         AT END MOVE AT-END TO ITRNO-STATUS.
001950     IF C-FOUND OF ITRNO-STATUS
001951        ADD 1 TO REC-READ-CNT. 
001952            
001953  WRITE-ITRNN.
001954     ADD 1 TO ITRNN-KEY.
001955     WRITE ITRNN-REC
001956         INVALID KEY MOVE ITRNN-STATUS TO ITRNN-STATUS.
001957     IF C-FOUND OF ITRNN-STATUS
001958        ADD 1 TO REC-WRITE-CNT
001959     ELSE
001960        Move ITRNN-Status      to DSP-Error-Code
001961        move ITRN-ITEM-NO OF ITRNN-REC     to Dsp-Error-Key
001962        move Error-Line        to Grid-Comment
001963        Perform Add-Grid-Line
001964         Add 1 to Conv-Error-Cnt
001965        Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
001966        ADD 1 TO REC-ERROR-CNT.     
001967         
001968  IN-OUT-EXIT. EXIT. 
001969*</SCRIPT>
001970 END PROGRAM     ProcConvertItrnF.
001971 IDENTIFICATION  DIVISION.
001972* ProcConvertPOHDF.
001973 PROGRAM-ID.     ProcConvertPOHDF IS COMMON.
001974*<SCRIPT DIVISION="PROCEDURE", NAME="ProcConvertPOHDF">
001975 ENVIRONMENT     DIVISION.
001976 INPUT-OUTPUT SECTION.
001977 FILE-CONTROL.
001978     COPY "POHDO.SL".
001979     COPY "POHDN.SL".
001980     
001981 DATA            DIVISION.
001982 FILE SECTION.
001983     COPY "POHDO.FD".
001984     COPY "POHDN.FD".
001985     
001986 WORKING-STORAGE SECTION.
001987     COPY "POHDN.DTA".
001988     COPY "POHDO.DTA".
001989
001990 01  Grid-Comment                 Pic x(150)          Value spaces.
001991 01  Grid-Filename                pic x(30)           Value spaces.
001992 01  Grid-Index                   Pic s9(9)  Comp-5   Value zero.
001993 
001994 01  REC-READ-CNT                 PIC S9(9)  COMP-5   VALUE ZERO.
001995 01  REC-WRITE-CNT                PIC S9(9)  COMP-5   VALUE ZERO.
001996 01  REC-ERROR-CNT                PIC S9(9)  COMP-5   VALUE ZERO.
001997 01  Ws-Error-Code                pic -9999           value zero.
001998 77  WHSE-NUMERIC                 PIC 9999            VALUE ZERO.
001999
002000 01  Error-Line.
002001     05  Filler                   Pic X(12)  value "Write Error=".
002002     05  Dsp-Error-Code           Pic xx     value spaces.
002003     05  Filler                   Pic X(07)  value " Write:".
002004     05  Dsp-Error-Key            Pic x(30)  value spaces.
002005
002006 01  Counts-Line.
002007     05  Filler                   Pic X(05)  value "Read:".
002008     05  Dsp-Read-Cnt             Pic z,zzz,zz9 value zero.
002009     05  Filler                   Pic X(07)  value " Write:".
002010     05  Dsp-Write-Cnt            Pic z,zzz,zz9 value zero.
002011     05  Filler                   Pic X(08)  value " Errors:".
002012     05  Dsp-Error-Cnt            Pic z,zzz,zz9 value zero.
002013
002014 01  MSG-STYLE                    PIC S9(9)  COMP-5   Value Zero.
002015 
002016 01  WS-File-Exists-msg.
002017     05  Filler                   pic x(40) value "The new data file already Exists!".
002018     05  Filler                   Pic X     value x"0A".
002019     05  filler                   pic x(40) Value "Do you want to overwrite it?".
002020     
002021 01  WS-New-File-Error-msg.
002022     05  Filler                   pic x(40) value "The file to be converted has returned".
002023     05  Filler                   Pic X     value x"0A".
002024     05  Filler                   pic x(40) value " an error!".
002025     05  Filler                   Pic X     value x"0A".
002026     05  filler                   pic x(40) Value "File conversion aborted!".
002027     
002028 01  WS-Old-File-Error-msg.
002029     05  Old-File-Msg            pic x(40) value "The file to be converted was not found!".
002030     05  Filler                   Pic X     value x"0A".
002031     05  filler                   pic x(40) Value "File conversion aborted!".
002032     
002033 
002034 PROCEDURE       DIVISION.
002035 DECLARATIVES.
002036     COPY "POHDO.DS".
002037     COPY "POHDN.DS".
002038     GO TO STATUS-EXIT.
002039        
002040 STATUS-CHECK.
002041           IF FILE-STATUS = RECORD-LOCK OR DUPLICATE-RECORD
002042              or NO-FILE or STRUCTURE-MISMATCH or PERMANENT-ERROR
002043              GO TO STATUS-EXIT.
002044
002045           SET DBIO OF ERROR-KIND TO TRUE.
002046           MOVE FILE-NAME        TO ERROR-DBIO.
002047           MOVE FILE-STATUS      TO IOSTATUS OF ERROR-DBIO.
002048           MOVE "45CONVERT.EXE"    TO ERROR-PROGRNAME.
002049           INVOKE POW-SELF "CallForm" USING "DBIOERROR" "ERRORBOX"
002050                 RETURNING ReturnValue.
002051           INVOKE POW-SELF "CloseForm" USING "ProfitsConversion"
002052                 RETURNING ReturnValue.
002053           EXIT PROGRAM.
002054           
002055 STATUS-EXIT. EXIT.       
002056 END DECLARATIVES. 
002057 BEGIN-PROGRAM.
002058     Move zero to Rec-Read-Cnt, Rec-Write-Cnt, Rec-Error-Cnt.
002059     MOVE "POBATHDR.FIL"  TO POHDO--NAME.
002060     MOVE "POBATHDR.V45"  TO POHDN--NAME.
002061     MOve zero to Msg-Style.
002062     PERFORM CONVERT-FILE THRU CONVERT-FILE-EXIT
002063
002064     Move zero to Rec-Read-Cnt, Rec-Write-Cnt, Rec-Error-Cnt.
002065     MOVE "POHDR.FIL"     TO POHDO--NAME.
002066     MOVE "POHDR.V45"     TO POHDN--NAME.
002067     MOve zero to Msg-Style.
002068     PERFORM CONVERT-FILE THRU CONVERT-FILE-EXIT.
002069
002070     Move zero to Rec-Read-Cnt, Rec-Write-Cnt, Rec-Error-Cnt.
002071     MOVE "POHSTHDR.FIL"   TO POHDO--NAME.
002072     MOVE "POHSTHDR.V45"   TO POHDN--NAME.
002073     MOve zero to Msg-Style.
002074     PERFORM CONVERT-FILE THRU CONVERT-FILE-EXIT.
002075
002076     
002077 END-PROGRAM.
002078     EXIT PROGRAM.     
002079     
002080     
002081*/////////////////////////////////////////
002082 CONVERT-FILE SECTION.     
002083*/////////////////////////////////////////
002084 CONVERT-BEGIN.
002085     PERFORM STRING-FILENAMES.
002086     Move Spaces to Grid-Comment.
002087     String "Working on: "          delimited by size
002088            POHDo-fullpath           delimited by space
002089            into Grid-Comment.
002090     Move Grid-Comment to "Caption" OF ctTextCurrStatus.
002091*     Move Pow-Color-Gray to "ItemBackColor"(grid-index) OF ctGridResults.
002092       
002093 CHECK-FOR-FILES.
002094     OPEN INPUT POHDN.
002095*-- If file does not exist, just continue on --*
002096     If POHDN-STATUS = NO-FILE
002097        NEXT SENTENCE
002098     ELSE
002099     If C-Found of POHDN-Status or POHDN-Status = "39"
002100*-- If file is found, ask user if it should be overwritten --*
002101        PERFORM NEW-FILE-ALREADY-EXISTS
002102        IF ReturnValue = Pow-DMRNo
002103           Move Zero   to Grid-Index
002104           MOVE "POHD" TO Grid-Filename
002105           Move spaces to Grid-Comment
002106           string POHDN-fullpath     delimited by space
002107                  " - Exists, Conversion Aborted by User." delimited by size
002108                  into Grid-Comment
002109           PERFORM ADD-GRID-LINE
002110         Add 1 to Conv-Error-Cnt
002111           Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
002112           Go to CONVERT-FILE-EXIT
002113        ELSE
002114           Move Zero   to Grid-Index
002115           MOVE "POHD" TO Grid-Filename
002116           Move spaces to Grid-Comment
002117           string POHDN-fullpath     delimited by space
002118                  " - File will be overwritten." delimited by size
002119                  into Grid-Comment
002120           PERFORM ADD-GRID-LINE
002121           Move Pow-Color-Yellow to "ItemBackColor"(grid-index) OF ctGridResults
002122     Else
002123         Perform New-File-Other-Error
002124         Move Spaces to Grid-Comment
002125         String POHDN-FullPath         delimited by spaces
002126                " - Error = "          delimited by size
002127                POHDN-Status           delimited by size
002128                into Grid-Comment
002129         Perform Add-Grid-Line
002130         Add 1 to Conv-Error-Cnt
002131         Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults.
002132         
002133                   
002134     OPEN INPUT POHDO.
002135*-- The file to be converted does not exist, Abort the conversion --*
002136     IF POHDO-STATUS = NO-FILe
002137        MOVE "The file to be converted was not found." TO OLD-FILE-MSG
002138        PERFORM OLD-FILE-ERROR-MSG
002139        Move Zero   to Grid-Index
002140        Move spaces to Grid-Comment
002141        string POHDO-fullpath     delimited by space
002142               " - Not Found, Conversion Aborted.    " delimited by size
002143               into Grid-Comment
002144        PERFORM ADD-GRID-LINE
002145         Add 1 to Conv-Error-Cnt
002146        Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
002147        Go to CONVERT-FILE-EXIT.
002148
002149*-- The file was found, but is not the correct starting layout (structure) --*
002150     IF POHDO-STATUS = STRUCTURE-MISMATCH
002151        MOVE "Wrong Starting version of this file." TO OLD-FILE-MSG
002152        PERFORM OLD-FILE-ERROR-MSG
002153        Move Zero   to Grid-Index
002154        Move spaces to Grid-Comment
002155        string POHDO-fullpath     delimited by space
002156               " - Wrong Starting Structure, Conversion Aborted.    " delimited by size
002157               into Grid-Comment
002158        PERFORM ADD-GRID-LINE
002159         Add 1 to Conv-Error-Cnt
002160        Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
002161        Go to CONVERT-FILE-EXIT.
002162    
002163*-- The file was found, but it appears to be corrupted --*
002164     IF POHDO-STATUS = PERMANENT-ERROR
002165        MOVE "The file seems to be corrupted." TO OLD-FILE-MSG
002166        PERFORM OLD-FILE-Error-Msg
002167        Move Zero   to Grid-Index
002168        Move spaces to Grid-Comment
002169        string POHDO-fullpath     delimited by space
002170               " - Corrupted, Try rebuilding it. Conversion Aborted.    " delimited by size
002171               into Grid-Comment
002172         Add 1 to Conv-Error-Cnt
002173        PERFORM ADD-GRID-LINE
002174        Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
002175        Go to CONVERT-FILE-EXIT.
002176
002177  
002178 File-Tests-Passed.                   
002179     Move Spaces to Grid-Comment.
002180     String "Converting - "          delimited by size
002181            POHDo-fullpath           delimited by space
002182            into Grid-Comment.
002183     perform Add-Grid-Line.
002184     Open Output POHDN.
002185     
002186 START-DATA-CONVERSION.
002187     PERFORM  PROCESS-RECORD UNTIL POHDO-STATUS NOT = FOUND.
002188     CLOSE POHDO, POHDN.
002189
002190 Update-Grid-With-Counts.
002191     Move Rec-Read-Cnt to Dsp-Read-Cnt.
002192     Move Rec-Write-Cnt to Dsp-Write-Cnt.
002193     Move Rec-Error-Cnt to Dsp-Error-Cnt.
002194     Move Counts-Line to Grid-Comment.
002195     Perform Add-Grid-Line.
002196       
002197 RENAME-FILES.
002198     If "Value" OF CmCheckSaveOrg = Pow-Tristate-Checked
002199        Perform Save-Original-File
002200        If Cbl_Status_Code not = Zero
002201           Move "POHD File Conversion Aborted" to Grid-Comment
002202           Perform ADD-GRID-LINE
002203           Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
002204         Add 1 to Conv-Error-Cnt
002205           Go To CONVERT-FILE-EXIT
002206        else
002207           Perform Delete-Original-File
002208           If Cbl_Status_Code not = Zero
002209              Move "Original File Delete Failed" to Grid-Comment
002210              Perform ADD-GRID-LINE
002211              Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
002212              Move "POHD File Conversion Aborted" to Grid-Comment
002213              Perform ADD-GRID-LINE
002214              Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
002215         Add 1 to Conv-Error-Cnt
002216              Go To CONVERT-FILE-EXIT
002217           else
002218              Next Sentence
002219     Else
002220        Perform Delete-Original-File
002221        If Cbl_Status_Code not = Zero
002222           Move "Original File Delete Failed" to Grid-Comment
002223           Perform ADD-GRID-LINE
002224           Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
002225           Move "POHD File Conversion Aborted" to Grid-Comment
002226           Perform ADD-GRID-LINE
002227           Add 1 to Conv-Error-Cnt
002228           Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
002229           Go To CONVERT-FILE-EXIT.
002230        
002231     Perform Rename-New-File.    
002232     IF CBL_STATUS_CODE NOT = ZERO
002233        Move "RENAME .V45 TO .FIL Failed" to Grid-Comment
002234        Perform ADD-GRID-LINE
002235        Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
002236        Move "POHD File Conversion Aborted" to Grid-Comment
002237        Perform ADD-GRID-LINE
002238         Add 1 to Conv-Error-Cnt
002239        Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
002240        Go To CONVERT-FILE-EXIT.
002241     
002242 FINISHED-CONVERSION.
002243        Move "POHD File Conversion Successful" to Grid-Comment.
002244        Perform ADD-GRID-LINE.
002245        Move Pow-Color-Green to "ItemBackColor"(grid-index) OF ctGridResults.
002246     
002247 CONVERT-FILE-EXIT. EXIT.
002248 
002249 SUBROUTINE SECTION.
002250 STRING-FILENAMES.     
002251       MOVE SPACES TO POHDO-FULLPATH.
002252       String  Profits-Programs-Loc   delimited by space
002253               "\"                    DELIMITED BY SIZE
002254               Profits-Data-Loc       delimited by space
002255               "\"                    DELIMITED BY SIZE
002256               POHDO--NAME            DELIMITED BY SPACE
002257               INTO POHDO-FULLPATH.
002258
002259       MOVE SPACES TO POHDN-FULLPATH.
002260       String  Profits-Programs-Loc   delimited by space
002261               "\"                    DELIMITED BY SIZE
002262               Profits-Data-Loc       delimited by space
002263               "\"                    DELIMITED BY SIZE
002264               POHDN--NAME             DELIMITED BY SPACE
002265               INTO POHDN-FULLPATH.
002266 ADD-GRID-LINE.
002267*     Move Pow-Color-Black to "ItemBackColor"(grid-index) OF ctGridResults.
002268     move zero to Grid-Index.
002269     INVOKE ctGridResults "InsertItem" USING Grid-Comment Grid-Index RETURNING ReturnValue.
002270
002271 New-File-Already-Exists.
002272      If C-found of POHDN-Status
002273         close POHDN.
002274      Move zero       to Msg-Style.
002275      Add Pow-DMYesNo to Msg-Style.
002276      Add Pow-DMIconQuestion to Msg-Style.
002277      INVOKE Pow-Self "DisplayMessage" 
002278             USING Ws-File-Exists-Msg
002279                   "Profits Warning"
002280                   msg-style
002281             RETURNING ReturnValue.
002282
002283 New-File-Other-Error.
002284      Move zero    to Msg-Style.
002285      Add Pow-DMOK to Msg-Style.
002286      Add Pow-DMIconExclamation to Msg-Style.
002287      INVOKE Pow-Self "DisplayMessage" 
002288             USING Ws-new-File-Error-Msg
002289                   "Profits Warning"
002290                   msg-style
002291             RETURNING ReturnValue.
002292
002293 OLD-File-Error-Msg.
002294      Move zero        to Msg-Style.
002295      Add Pow-DMOK     to Msg-Style.
002296      Add Pow-DMIconExclamation to Msg-Style.
002297      INVOKE Pow-Self "DisplayMessage" 
002298             USING Ws-Old-file-Error-msg
002299                   "Profits Warning"
002300                   msg-style
002301             RETURNING ReturnValue.
002302             
002303 PROCESS-RECORD.
002304         PERFORM READ-POHDO.
002305         IF C-FOUND OF POHDO-STATUS
002306            PERFORM MOVE-DATA
002307            PERFORM WRITE-POHDN.
002308
002309      MOVE POHDN-KEY    OF POHDN-REC   TO "Caption" OF ctTextPKey.
002310      MOVE REC-READ-CNT                TO "Value" OF ctNEditReadCnt.
002311      MOVE REC-WRITE-CNT               TO "Value" OF ctNEditWriteCnt.
002312      MOVE REC-ERROR-CNT               TO "Value" OF ctNEditErrorCnt.
002313      MOVE Conv-ERROR-CNT              TO "Value" OF ctNEditConvCnt.
002314      INVOKE POW-SELF "Refresh".
002315
002316 MOVE-DATA.  
002317      MOVE SPACES       TO POHDN-REC.
002318      MOVE POHDO-REC    TO POHDN-REC.
002319
002320 Save-Original-File.
002321      MOVE POHDO-FULLPATH  TO CBL_FROM_PATH, CBL_TO_PATH.
002322      INSPECT CBL_TO_PATH REPLACING FIRST ".FIL" BY ".ORG".
002323      CALL "CBL_COPY_FILE"
002324           USING CBL_FROM_PATH CBL_TO_PATH 
002325           RETURNING CBL_STATUS_CODE.
002326      IF CBL_STATUS_CODE NOT = ZERO
002327         MOVE CBL_STATUS_CODE TO WS-ERROR-CODE
002328         MOVE SPACES TO GRID-COMMENT
002329         STRING "Error = "         DELIMITED BY size
002330                WS-ERROR-CODE      DELIMITED BY SIZE
002331                " - Save Original Failed" delimited by size
002332                into Grid-Comment
002333         perform ADD-GRID-LINE
002334         Add 1 to Conv-Error-Cnt
002335         Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults.
002336      
002337 Delete-Original-File.
002338      MOVE POHDO-FULLPATH  TO CBL_FROM_PATH.
002339      Call "CBL_DELETE_FILE"
002340           using CBL_From_Path
002341           Returning CBL_Status_Code.
002342           
002343 Rename-New-File.
002344      MOVE POHDN-FULLPATH TO CBL_TO_PATH, CBL_FROM_PATH.
002345      INSPECT CBL_TO_PATH REPLACING FIRST ".V45" BY ".FIL".
002346      CALL "CBL_RENAME_FILE"
002347           USING CBL_FROM_PATH CBL_TO_PATH
002348           RETURNING CBL_STATUS_CODE.
002349          
002350      
002351 SUBROUTINE-EXIT. EXIT.     
002352 
002353  IN-OUT SECTION.
002354  START-POHDO.
002355     START POHDO KEY IS NOT < POHDO-KEY
002356         INVALID KEY MOVE POHDO-STATUS TO POHDO-STATUS.
002357         
002358  READ-POHDO.
002359     READ POHDO NEXT
002360         AT END MOVE AT-END TO POHDO-STATUS.
002361     IF C-FOUND OF POHDO-STATUS
002362        ADD 1 TO REC-READ-CNT. 
002363            
002364  WRITE-POHDN.
002365     WRITE POHDN-REC
002366         INVALID KEY MOVE POHDN-STATUS TO POHDN-STATUS.
002367     IF C-FOUND OF POHDN-STATUS
002368        ADD 1 TO REC-WRITE-CNT
002369     ELSE
002370        Move POHDN-Status      to DSP-Error-Code
002371        move POHDO-KEY         to Dsp-Error-Key
002372        move Error-Line        to Grid-Comment
002373        Perform Add-Grid-Line
002374         Add 1 to Conv-Error-Cnt
002375        Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
002376        ADD 1 TO REC-ERROR-CNT.     
002377         
002378  IN-OUT-EXIT. EXIT. 
002379*</SCRIPT>
002380 END PROGRAM     ProcConvertPOHDF.
002381 IDENTIFICATION  DIVISION.
002382* ProcCheckUserF.
002383 PROGRAM-ID.     ProcCheckUserF IS COMMON.
002384*<SCRIPT DIVISION="PROCEDURE", NAME="ProcCheckUserF">
002385 ENVIRONMENT     DIVISION.
002386 DATA            DIVISION.
002387 WORKING-STORAGE SECTION.
002388 01  WS-DMSTYLE        PIC S9(7)  COMP-5  VALUE ZERO.
002389 01  USERF-MSG.
002390     05  PIC X(40) VALUE "The USER.FIL file has been Initialized. ".
002391     05  pic x(01) value X"0A".
002392     05  pic x(01) value X"0A".
002393     05  pic x(40) VALUE "This new version will use the COMPUTER  ".
002394     05  pic x(01) value X"0A".
002395     05  pic x(40) value "NAME instead of the IP Address to ident-".
002396     05  pic x(01) value X"0A".
002397     05  pic x(40) value "ify each workstation.                   ".
002398     05  pic x(01) value X"0A".
002399     05  pic x(01) value X"0A".
002400     05  pic x(40) value "Because of this change we were not able ".
002401     05  pic x(01) value X"0A".
002402     05  pic x(40) value "to convert your existing settings.  You ".
002403     05  pic x(01) value X"0A".
002404     05  pic x(40) value "will need to reset each users settings, ".
002405     05  pic x(01) value X"0A".
002406     05  pic x(40) value "using menu 1.5.4.  If you have a lot of ".
002407     05  pic x(01) value X"0A".
002408     05  pic x(40) value "workstations please contact PCS for some".
002409     05  pic x(01) value X"0A".
002410     05  pic x(40) value "time saving alternatives.               ".
002411     05  pic x(01) value X"0A".
002412     
002413 PROCEDURE       DIVISION.
002414 DECLARATIVES.
002415     COPY "USERF.DS".
002416     GO TO STATUS-EXIT.
002417        
002418 STATUS-CHECK.
002419*-           IF FILE-STATUS = RECORD-LOCK OR DUPLICATE-RECORD
002420          IF FILE-STATUS NOT = FOUND
002421              GO TO STATUS-EXIT.
002422
002423           SET DBIO OF ERROR-KIND TO TRUE.
002424           MOVE FILE-NAME         TO ERROR-DBIO.
002425           MOVE FILE-STATUS       TO IOSTATUS OF ERROR-DBIO.
002426           MOVE "44CONVERT"       TO ERROR-PROGRNAME.
002427           INVOKE POW-SELF "CallForm" USING "DBIOERROR" "ERRORBOX"
002428                 RETURNING ReturnValue.
002429           INVOKE POW-SELF "CloseForm" USING "ProfitsConversion"
002430                 RETURNING ReturnValue.
002431           EXIT PROGRAM.
002432           
002433 STATUS-EXIT. EXIT.       
002434 END DECLARATIVES. 
002435 BEGIN-PROGRAM.
002436     COPY "USERF.SR".           
002437     Open INPUT UserF.
002438     If "Value" OF CmCheckSaveOrg = Pow-Tristate-Checked
002439        IF USERF-STATUS = 39
002440           PERFORM RENAME-ORG-FILE.
002441
002442     IF USERF-STATUS = NO-FILE OR USERF-STATUS = 39
002443        OPEN OUTPUT USERF
002444        CLOSE USERF
002445        OPEN I-O USERF
002446        PERFORM INIT-USERF
002447        PERFORM DISPLAY-MESSAGE.
002448        
002449
002450 END-PROGRAM.
002451     CLOSE USERF.
002452     EXIT PROGRAM.     
002453
002454 INIT-USERF.
002455     MOVE SPACES TO USERF-REC.
002456     MOVE "MasterUserRecord"   TO USERF-KEY.
002457     MOVE "COMP0000"           TO USER-SUB-DIR.
002458     MOVE 0 TO USER-LAST-OPTION, USER-POS-ORDER, USER-MENU-OPTION.
002459     MOVE 1 TO USER-COUNT
002460     MOVE 0 TO USER-PTR-CHN.
002461     MOVE 1 TO USER-TERMID. 
002462     MOVE 2 TO USER-SPOOL-CD. 
002463     MOVE 1 TO USER-FORMS-DEFAULT, USER-STOCK-DEFAULT, 
002464               USER-DEFAULT-OVERRIDE, USER-DEFAULT-CODES.
002465     MOVE ZEROES TO USER-OPTIONS(1), USER-OPTIONS(2), 
002466          USER-OPTIONS(3), USER-OPTIONS(4), USER-OPTIONS(5),
002467          USER-OPTIONS(6), USER-OPTIONS(7).
002468     MOVE "A" TO USER-BKUP-DRIVE, USER-FLOPPY-DRIVE.
002469     MOVE 3   TO USER-BKUP-METHOD-CD.
002470     MOVE 8   TO USER-FGRND-COLOR-CD.
002471     MOVE 1   TO USER-BGRND-COLOR-CD.
002472     MOVE 1   TO USER-PTR-OUT, USER-PTR-SPL, USER-PTR-CODES,
002473                 USER-LABEL-DEFAULT-PTR, USER-LABEL-DEFAULT-CODES,
002474                 USER-DUPLEX-CD, USER-PAPER-TRAY.
002475     MOVE 2   TO USER-OE-COST-ACCESS, USER-REPRINT-INVOICE.
002476     MOVE 0   TO USER-PROTECTION-DEVICE.
002477     MOVE "A" TO USER-BKUP-DRIVE.
002478     MOVE 3   TO USER-BKUP-METHOD-CD.
002479     MOVE 3   TO USER-EXPERT-SOUND-CD.
002480     MOVE SPACES TO USER-PRE-PHONE-ACCESS.
002481     MOVE 0      TO USER-ORDER-DATE, USER-SHIP-DATE.
002482     MOVE 1   TO USER-SLSMN-OVERRIDE-CD.
002483     MOVE 1   TO USER-ORDER-TYPE-FLAG.
002484     MOVE 0   TO USER-BATCH-NO.
002485     MOVE 1   TO USER-SHOW-GP-CD.
002486     MOVE 1   TO USER-KEY-LOCKS-CD.
002487     MOVE 0   TO USER-POS-SUB-ORDER.
002488     MOVE 1   TO USER-ASK-LF-COPIES-CD.
002489     MOVE 1   TO USER-OE-VIEW-ONLY-CD.
002490     MOVE 2   TO USER-IMS-FAX-ACK-CD.
002491     MOVE 2   TO USER-AUTO-BACKUP-CD.
002492     MOVE ZEROES TO USER-SLSMN-NO.
002493     MOVE 36000  TO USER-KILL-DATE-JULIAN.
002494     MOVE 0      TO USER-MAX-CONCURRENT-USERS.
002495     MOVE "UNKNOWN" TO USER-PCS-CUST-ID.
002496     MOVE 2      TO USER-PDF-PROMPT-INFO,
002497                    USER-PDF-DISPLAY.
002498     WRITE USERF-REC
002499           INVALID KEY DISPLAY "USER WRITE ERROR".
002500 
002501 
002502 DISPLAY-MESSAGE.
002503     MOVE POW-DMOK     TO WS-DMSTYLE.
002504     ADD  POW-DMICONINFORMATION TO WS-DMSTYLE.
002505     INVOKE POW-SELF "DisplayMessage"
002506            USING UserF-Msg
002507                 "User.Fil Initialized"
002508                 WS-DMSTYLE
002509            RETURNING ReturnValue.    
002510            
002511 Rename-ORG-File.
002512      MOVE USERF-FULLPATH TO CBL_TO_PATH, CBL_FROM_PATH.
002513      INSPECT CBL_TO_PATH REPLACING FIRST ".FIL" BY ".ORG".
002514      CALL "CBL_RENAME_FILE"
002515           USING CBL_FROM_PATH CBL_TO_PATH
002516           RETURNING CBL_STATUS_CODE.
002517            
002518*</SCRIPT>
002519 END PROGRAM     ProcCheckUserF.
002520 IDENTIFICATION  DIVISION.
002521* ProcConvertChrtF.
002522 PROGRAM-ID.     ProcConvertChrtF IS COMMON.
002523*<SCRIPT DIVISION="PROCEDURE", NAME="ProcConvertChrtF">
002524 ENVIRONMENT     DIVISION.
002525 INPUT-OUTPUT SECTION.
002526 FILE-CONTROL.
002527     COPY "CHRTO.SL".
002528     COPY "CHRTN.SL".
002529     
002530 DATA            DIVISION.
002531 FILE SECTION.
002532     COPY "CHRTO.FD".
002533     COPY "CHRTN.FD".
002534     
002535 WORKING-STORAGE SECTION.
002536     COPY "CHRTN.DTA".
002537     COPY "CHRTO.DTA".
002538
002539 01  Grid-Comment                 Pic x(150)          Value spaces.
002540 01  Grid-Filename                pic x(30)           Value spaces.
002541 01  Grid-Index                   Pic s9(9)  Comp-5   Value zero.
002542 
002543 01  REC-READ-CNT                 PIC S9(9)  COMP-5   VALUE ZERO.
002544 01  REC-WRITE-CNT                PIC S9(9)  COMP-5   VALUE ZERO.
002545 01  REC-ERROR-CNT                PIC S9(9)  COMP-5   VALUE ZERO.
002546 01  Ws-Error-Code                pic -9999           value zero.
002547 77  WHSE-NUMERIC                 PIC 9999            VALUE ZERO.
002548
002549 01  Error-Line.
002550     05  Filler                   Pic X(12)  value "Write Error=".
002551     05  Dsp-Error-Code           Pic xx     value spaces.
002552     05  Filler                   Pic X(07)  value " Write:".
002553     05  Dsp-Error-Key            Pic x(30)  value spaces.
002554
002555 01  Counts-Line.
002556     05  Filler                   Pic X(05)  value "Read:".
002557     05  Dsp-Read-Cnt             Pic z,zzz,zz9 value zero.
002558     05  Filler                   Pic X(07)  value " Write:".
002559     05  Dsp-Write-Cnt            Pic z,zzz,zz9 value zero.
002560     05  Filler                   Pic X(08)  value " Errors:".
002561     05  Dsp-Error-Cnt            Pic z,zzz,zz9 value zero.
002562
002563 01  MSG-STYLE                    PIC S9(9)  COMP-5   Value Zero.
002564 
002565 01  WS-File-Exists-msg.
002566     05  Filler                   pic x(40) value "The new data file already Exists!".
002567     05  Filler                   Pic X     value x"0A".
002568     05  filler                   pic x(40) Value "Do you want to overwrite it?".
002569     
002570 01  WS-New-File-Error-msg.
002571     05  Filler                   pic x(40) value "The file to be converted has returned".
002572     05  Filler                   Pic X     value x"0A".
002573     05  Filler                   pic x(40) value " an error!".
002574     05  Filler                   Pic X     value x"0A".
002575     05  filler                   pic x(40) Value "File conversion aborted!".
002576     
002577 01  WS-Old-File-Error-msg.
002578     05  Old-File-Msg            pic x(40) value "The file to be converted was not found!".
002579     05  Filler                   Pic X     value x"0A".
002580     05  filler                   pic x(40) Value "File conversion aborted!".
002581     
002582 
002583 PROCEDURE       DIVISION.
002584 DECLARATIVES.
002585     COPY "CHRTO.DS".
002586     COPY "CHRTN.DS".
002587     GO TO STATUS-EXIT.
002588        
002589 STATUS-CHECK.
002590           IF FILE-STATUS = RECORD-LOCK OR DUPLICATE-RECORD
002591              or NO-FILE or STRUCTURE-MISMATCH or PERMANENT-ERROR
002592              GO TO STATUS-EXIT.
002593
002594           SET DBIO OF ERROR-KIND TO TRUE.
002595           MOVE FILE-NAME        TO ERROR-DBIO.
002596           MOVE FILE-STATUS      TO IOSTATUS OF ERROR-DBIO.
002597           MOVE "45CONVERT.EXE"    TO ERROR-PROGRNAME.
002598           INVOKE POW-SELF "CallForm" USING "DBIOERROR" "ERRORBOX"
002599                 RETURNING ReturnValue.
002600           INVOKE POW-SELF "CloseForm" USING "ProfitsConversion"
002601                 RETURNING ReturnValue.
002602           EXIT PROGRAM.
002603           
002604 STATUS-EXIT. EXIT.       
002605 END DECLARATIVES. 
002606 BEGIN-PROGRAM.
002607     Move zero to Rec-Read-Cnt, Rec-Write-Cnt, Rec-Error-Cnt.
002608     MOVE "CHART.FIL"    TO CHRTO--NAME.
002609     MOVE "CHART.V45"    TO CHRTN--NAME.
002610     MOve zero to Msg-Style.
002611     
002612     PERFORM STRING-FILENAMES.
002613     Move Spaces to Grid-Comment.
002614     String "Working on: "          delimited by size
002615            CHRTo-fullpath           delimited by space
002616            into Grid-Comment.
002617     Move Grid-Comment to "Caption" OF ctTextCurrStatus.
002618*     Move Pow-Color-Gray to "CHRTBackColor"(grid-index) OF ctGridResults.
002619       
002620 CHECK-FOR-FILES.
002621     OPEN INPUT CHRTN.
002622*-- If file does not exist, just continue on --*
002623     If CHRTN-STATUS = NO-FILE
002624        NEXT SENTENCE
002625     ELSE
002626     If C-Found of CHRTN-Status or CHRTN-Status = "39"
002627*-- If file is found, ask user if it should be overwritten --*
002628        PERFORM NEW-FILE-ALREADY-EXISTS
002629        IF ReturnValue = Pow-DMRNo
002630           Move Zero   to Grid-Index
002631           MOVE "CHRT" TO Grid-Filename
002632           Move spaces to Grid-Comment
002633           string CHRTN-fullpath     delimited by space
002634                  " - Exists, Conversion Aborted by User." delimited by size
002635                  into Grid-Comment
002636           PERFORM ADD-GRID-LINE
002637           Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
002638         Add 1 to Conv-Error-Cnt
002639           Go to End-Program
002640        ELSE
002641           Move Zero   to Grid-Index
002642           MOVE "CHRT" TO Grid-Filename
002643           Move spaces to Grid-Comment
002644           string CHRTN-fullpath     delimited by space
002645                  " - File will be overwritten." delimited by size
002646                  into Grid-Comment
002647           PERFORM ADD-GRID-LINE
002648           Move Pow-Color-Yellow to "ItemBackColor"(grid-index) OF ctGridResults
002649     Else
002650         Perform New-File-Other-Error
002651         Move Spaces to Grid-Comment
002652         String CHRTN-FullPath         delimited by spaces
002653                " - Error = "          delimited by size
002654                CHRTN-Status           delimited by size
002655                into Grid-Comment
002656         Perform Add-Grid-Line
002657         Add 1 to Conv-Error-Cnt
002658         Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults.
002659         
002660                   
002661     OPEN INPUT CHRTO.
002662*-- The file to be converted does not exist, Abort the conversion --*
002663     IF CHRTO-STATUS = NO-FILe
002664        MOVE "The file to be converted was not found." TO OLD-FILE-MSG
002665        PERFORM OLD-FILE-ERROR-MSG
002666        Move Zero   to Grid-Index
002667        Move spaces to Grid-Comment
002668        string CHRTO-fullpath     delimited by space
002669               " - Not Found, Conversion Aborted.    " delimited by size
002670               into Grid-Comment
002671        PERFORM ADD-GRID-LINE
002672        Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
002673         Add 1 to Conv-Error-Cnt
002674        Go to End-Program.
002675
002676*-- The file was found, but is not the correct starting layout (structure) --*
002677     IF CHRTO-STATUS = STRUCTURE-MISMATCH
002678        MOVE "Wrong Starting version of this file." TO OLD-FILE-MSG
002679        PERFORM OLD-FILE-ERROR-MSG
002680        Move Zero   to Grid-Index
002681        Move spaces to Grid-Comment
002682        string CHRTO-fullpath     delimited by space
002683               " - Wrong Starting Structure, Conversion Aborted.    " delimited by size
002684               into Grid-Comment
002685        PERFORM ADD-GRID-LINE
002686        Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
002687         Add 1 to Conv-Error-Cnt
002688        Go to End-Program.
002689    
002690*-- The file was found, but it appears to be corrupted --*
002691     IF CHRTO-STATUS = PERMANENT-ERROR
002692        MOVE "The file seems to be corrupted." TO OLD-FILE-MSG
002693        PERFORM OLD-FILE-Error-Msg
002694        Move Zero   to Grid-Index
002695        Move spaces to Grid-Comment
002696        string CHRTO-fullpath     delimited by space
002697               " - Corrupted, Try rebuilding it. Conversion Aborted.    " delimited by size
002698               into Grid-Comment
002699        PERFORM ADD-GRID-LINE
002700        Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
002701         Add 1 to Conv-Error-Cnt
002702        Go to End-Program.
002703
002704  
002705 File-Tests-Passed.                   
002706     Move Spaces to Grid-Comment.
002707     String "Converting - "          delimited by size
002708            CHRTo-fullpath           delimited by space
002709            into Grid-Comment.
002710     perform Add-Grid-Line.
002711     Open Output CHRTN.
002712     
002713 START-DATA-CONVERSION.
002714     PERFORM  PROCESS-RECORD UNTIL CHRTO-STATUS NOT = FOUND.
002715     CLOSE CHRTO, CHRTN.
002716
002717 Update-Grid-With-Counts.
002718     Move Rec-Read-Cnt to Dsp-Read-Cnt.
002719     Move Rec-Write-Cnt to Dsp-Write-Cnt.
002720     Move Rec-Error-Cnt to Dsp-Error-Cnt.
002721     Move Counts-Line to Grid-Comment.
002722     Perform Add-Grid-Line.
002723       
002724 RENAME-FILES.
002725     If "Value" OF CmCheckSaveOrg = Pow-Tristate-Checked
002726        Perform Save-Original-File
002727        If Cbl_Status_Code not = Zero
002728           Move "CHRT File Conversion Aborted" to Grid-Comment
002729           Perform ADD-GRID-LINE
002730           Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
002731         Add 1 to Conv-Error-Cnt
002732           Go To End-Program
002733        else
002734           Perform Delete-Original-File
002735           If Cbl_Status_Code not = Zero
002736              Move "Original File Delete Failed" to Grid-Comment
002737              Perform ADD-GRID-LINE
002738              Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
002739              Move "CHRT File Conversion Aborted" to Grid-Comment
002740              Perform ADD-GRID-LINE
002741              Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
002742         Add 1 to Conv-Error-Cnt
002743              Go To End-Program
002744           else
002745              Next Sentence
002746     Else
002747        Perform Delete-Original-File
002748        If Cbl_Status_Code not = Zero
002749           Move "Original File Delete Failed" to Grid-Comment
002750           Perform ADD-GRID-LINE
002751           Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
002752           Move "CHRT File Conversion Aborted" to Grid-Comment
002753           Perform ADD-GRID-LINE
002754           Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
002755         Add 1 to Conv-Error-Cnt
002756           Go To End-Program.
002757        
002758     Perform Rename-New-File.    
002759     IF CBL_STATUS_CODE NOT = ZERO
002760        Move "RENAME .V45 TO .FIL Failed" to Grid-Comment
002761        Perform ADD-GRID-LINE
002762        Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
002763        Move "CHRT File Conversion Aborted" to Grid-Comment
002764        Perform ADD-GRID-LINE
002765        Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
002766         Add 1 to Conv-Error-Cnt
002767        Go To End-Program.
002768     
002769 FINISHED-CONVERSION.
002770        Move "CHRT File Conversion Successful" to Grid-Comment.
002771        Perform ADD-GRID-LINE.
002772        Move Pow-Color-Green to "ItemBackColor"(grid-index) OF ctGridResults.
002773     
002774 END-PROGRAM.
002775     EXIT PROGRAM.     
002776
002777 SUBROUTINE SECTION.
002778 STRING-FILENAMES.     
002779       MOVE SPACES TO CHRTO-FULLPATH.
002780       String  Profits-Programs-Loc   delimited by space
002781               "\"                    DELIMITED BY SIZE
002782               Profits-Data-Loc       delimited by space
002783               "\"                    DELIMITED BY SIZE
002784               CHRTO--NAME            DELIMITED BY SPACE
002785               INTO CHRTO-FULLPATH.
002786
002787       MOVE SPACES TO CHRTN-FULLPATH.
002788       String  Profits-Programs-Loc   delimited by space
002789               "\"                    DELIMITED BY SIZE
002790               Profits-Data-Loc       delimited by space
002791               "\"                    DELIMITED BY SIZE
002792               CHRTN--NAME             DELIMITED BY SPACE
002793               INTO CHRTN-FULLPATH.
002794 ADD-GRID-LINE.
002795*     Move Pow-Color-Black to "ItemBackColor"(grid-index) OF ctGridResults.
002796     move zero to Grid-Index.
002797     INVOKE ctGridResults "InsertItem" USING Grid-Comment Grid-Index RETURNING ReturnValue.
002798
002799 New-File-Already-Exists.
002800      If C-found of CHRTN-Status
002801         close CHRTN.
002802      Move zero       to Msg-Style.
002803      Add Pow-DMYesNo to Msg-Style.
002804      Add Pow-DMIconQuestion to Msg-Style.
002805      INVOKE Pow-Self "DisplayMessage" 
002806             USING Ws-File-Exists-Msg
002807                   "Profits Warning"
002808                   msg-style
002809             RETURNING ReturnValue.
002810
002811 New-File-Other-Error.
002812      Move zero    to Msg-Style.
002813      Add Pow-DMOK to Msg-Style.
002814      Add Pow-DMIconExclamation to Msg-Style.
002815      INVOKE Pow-Self "DisplayMessage" 
002816             USING Ws-new-File-Error-Msg
002817                   "Profits Warning"
002818                   msg-style
002819             RETURNING ReturnValue.
002820
002821 OLD-File-Error-Msg.
002822      Move zero        to Msg-Style.
002823      Add Pow-DMOK     to Msg-Style.
002824      Add Pow-DMIconExclamation to Msg-Style.
002825      INVOKE Pow-Self "DisplayMessage" 
002826             USING Ws-Old-file-Error-msg
002827                   "Profits Warning"
002828                   msg-style
002829             RETURNING ReturnValue.
002830             
002831 PROCESS-RECORD.
002832         PERFORM READ-CHRTO.
002833         IF C-FOUND OF CHRTO-STATUS
002834            PERFORM MOVE-DATA
002835            PERFORM WRITE-CHRTN.
002836
002837      MOVE CHRT-ACCT-NO OF CHRTN-REC   TO "Caption" OF ctTextPKey.
002838      MOVE REC-READ-CNT                TO "Value" OF ctNEditReadCnt.
002839      MOVE REC-WRITE-CNT               TO "Value" OF ctNEditWriteCnt.
002840      MOVE REC-ERROR-CNT               TO "Value" OF ctNEditErrorCnt.
002841      MOVE Conv-ERROR-CNT              TO "Value" OF ctNEditConvCnt.
002842      INVOKE POW-SELF "Refresh".
002843
002844 MOVE-DATA.  
002845     MOVE SPACES                       TO CHRTN-REC.
002846     MOVE CHRTO-REC                    TO CHRTN-REC.
002847     MOVE CHRT-SISKIN-NO OF CHRTO-REC  TO CHRT-ALT-NO OF CHRTN-REC.
002848
002849 Save-Original-File.
002850      MOVE CHRTO-FULLPATH  TO CBL_FROM_PATH, CBL_TO_PATH.
002851      INSPECT CBL_TO_PATH REPLACING FIRST ".FIL" BY ".ORG".
002852      CALL "CBL_COPY_FILE"
002853           USING CBL_FROM_PATH CBL_TO_PATH 
002854           RETURNING CBL_STATUS_CODE.
002855      IF CBL_STATUS_CODE NOT = ZERO
002856         MOVE CBL_STATUS_CODE TO WS-ERROR-CODE
002857         MOVE SPACES TO GRID-COMMENT
002858         STRING "Error = "         DELIMITED BY size
002859                WS-ERROR-CODE      DELIMITED BY SIZE
002860                " - Save Original Failed" delimited by size
002861                into Grid-Comment
002862         perform ADD-GRID-LINE
002863         Add 1 to Conv-Error-Cnt
002864         Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults.
002865      
002866 Delete-Original-File.
002867      MOVE CHRTO-FULLPATH  TO CBL_FROM_PATH.
002868      Call "CBL_DELETE_FILE"
002869           using CBL_From_Path
002870           Returning CBL_Status_Code.
002871           
002872 Rename-New-File.
002873      MOVE CHRTN-FULLPATH TO CBL_TO_PATH, CBL_FROM_PATH.
002874      INSPECT CBL_TO_PATH REPLACING FIRST ".V45" BY ".FIL".
002875      CALL "CBL_RENAME_FILE"
002876           USING CBL_FROM_PATH CBL_TO_PATH
002877           RETURNING CBL_STATUS_CODE.
002878          
002879      
002880 SUBROUTINE-EXIT. EXIT.     
002881 
002882  IN-OUT SECTION.
002883  START-CHRTO.
002884     START CHRTO KEY IS NOT < CHRTO-KEY
002885         INVALID KEY MOVE CHRTO-STATUS TO CHRTO-STATUS.
002886         
002887  READ-CHRTO.
002888     READ CHRTO NEXT
002889         AT END MOVE AT-END TO CHRTO-STATUS.
002890     IF C-FOUND OF CHRTO-STATUS
002891        ADD 1 TO REC-READ-CNT. 
002892            
002893  WRITE-CHRTN.
002894     WRITE CHRTN-REC
002895         INVALID KEY MOVE CHRTN-STATUS TO CHRTN-STATUS.
002896     IF C-FOUND OF CHRTN-STATUS
002897        ADD 1 TO REC-WRITE-CNT
002898     ELSE
002899        Move CHRTN-Status to DSP-Error-Code
002900        move CHRTN-Key    to Dsp-Error-Key
002901        move Error-Line to Grid-Comment
002902        Perform Add-Grid-Line
002903         Add 1 to Conv-Error-Cnt
002904        Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
002905        ADD 1 TO REC-ERROR-CNT.     
002906         
002907  IN-OUT-EXIT. EXIT.   
002908*</SCRIPT>
002909 END PROGRAM     ProcConvertChrtF.
002910 IDENTIFICATION  DIVISION.
002911* ProcConvertItemF.
002912 PROGRAM-ID.     ProcConvertItemF IS COMMON.
002913*<SCRIPT DIVISION="PROCEDURE", NAME="ProcConvertItemF">
002914 ENVIRONMENT     DIVISION.
002915 INPUT-OUTPUT SECTION.
002916 FILE-CONTROL.
002917     COPY "ITEMO.SL".
002918     COPY "ITEMN.SL".
002919     
002920 DATA            DIVISION.
002921 FILE SECTION.
002922     COPY "ITEMO.FD".
002923     COPY "ITEMN.FD".
002924     
002925 WORKING-STORAGE SECTION.
002926     COPY "ITEMN.DTA".
002927     COPY "ITEMO.DTA".
002928
002929 01  Grid-Comment                 Pic x(150)          Value spaces.
002930 01  Grid-Filename                pic x(30)           Value spaces.
002931 01  Grid-Index                   Pic s9(9)  Comp-5   Value zero.
002932 
002933 01  REC-READ-CNT                 PIC S9(9)  COMP-5   VALUE ZERO.
002934 01  REC-WRITE-CNT                PIC S9(9)  COMP-5   VALUE ZERO.
002935 01  REC-ERROR-CNT                PIC S9(9)  COMP-5   VALUE ZERO.
002936 01  Ws-Error-Code                pic -9999           value zero.
002937 77  WHSE-NUMERIC                 PIC 9999            VALUE ZERO.
002938 
002939 01  Error-Line.
002940     05  Filler                   Pic X(12)  value "Write Error=".
002941     05  Dsp-Error-Code           Pic xx     value spaces.
002942     05  Filler                   Pic X(07)  value " Write:".
002943     05  Dsp-Error-Key            Pic x(30)  value spaces.
002944
002945 01  Counts-Line.
002946     05  Filler                   Pic X(05)  value "Read:".
002947     05  Dsp-Read-Cnt             Pic z,zzz,zz9 value zero.
002948     05  Filler                   Pic X(07)  value " Write:".
002949     05  Dsp-Write-Cnt            Pic z,zzz,zz9 value zero.
002950     05  Filler                   Pic X(08)  value " Errors:".
002951     05  Dsp-Error-Cnt            Pic z,zzz,zz9 value zero.
002952
002953 01  MSG-STYLE                    PIC S9(9)  COMP-5   Value Zero.
002954 
002955 01  WS-File-Exists-msg.
002956     05  Filler                   pic x(40) value "The new data file already Exists!".
002957     05  Filler                   Pic X     value x"0A".
002958     05  filler                   pic x(40) Value "Do you want to overwrite it?".
002959     
002960 01  WS-New-File-Error-msg.
002961     05  Filler                   pic x(40) value "The file to be converted has returned".
002962     05  Filler                   Pic X     value x"0A".
002963     05  Filler                   pic x(40) value " an error!".
002964     05  Filler                   Pic X     value x"0A".
002965     05  filler                   pic x(40) Value "File conversion aborted!".
002966     
002967 01  WS-Old-File-Error-msg.
002968     05  Old-File-Msg            pic x(40) value "The file to be converted was not found!".
002969     05  Filler                   Pic X     value x"0A".
002970     05  filler                   pic x(40) Value "File conversion aborted!".
002971     
002972 
002973 PROCEDURE       DIVISION.
002974 DECLARATIVES.
002975     COPY "ITEMO.DS".
002976     COPY "ITEMN.DS".
002977     GO TO STATUS-EXIT.
002978        
002979 STATUS-CHECK.
002980           IF FILE-STATUS = RECORD-LOCK OR DUPLICATE-RECORD
002981              or NO-FILE or STRUCTURE-MISMATCH or PERMANENT-ERROR
002982              GO TO STATUS-EXIT.
002983
002984           SET DBIO OF ERROR-KIND TO TRUE.
002985           MOVE FILE-NAME        TO ERROR-DBIO.
002986           MOVE FILE-STATUS      TO IOSTATUS OF ERROR-DBIO.
002987           MOVE "45CONVERT.EXE"    TO ERROR-PROGRNAME.
002988           INVOKE POW-SELF "CallForm" USING "DBIOERROR" "ERRORBOX"
002989                 RETURNING ReturnValue.
002990           INVOKE POW-SELF "CloseForm" USING "ProfitsConversion"
002991                 RETURNING ReturnValue.
002992           EXIT PROGRAM.
002993           
002994 STATUS-EXIT. EXIT.       
002995 END DECLARATIVES. 
002996 BEGIN-PROGRAM.
002997     Move zero to Rec-Read-Cnt, Rec-Write-Cnt, Rec-Error-Cnt.
002998     MOVE "ITEM.FIL"    TO ITEMO--NAME.
002999     MOVE "ITEM.V45"    TO ITEMN--NAME.
003000     MOve zero to Msg-Style.
003001     
003002     PERFORM STRING-FILENAMES.
003003     Move Spaces to Grid-Comment.
003004     String "Working on: "          delimited by size
003005            itemo-fullpath           delimited by space
003006            into Grid-Comment.
003007     Move Grid-Comment to "Caption" OF ctTextCurrStatus.
003008*     Move Pow-Color-Gray to "ItemBackColor"(grid-index) OF ctGridResults.
003009       
003010 CHECK-FOR-FILES.
003011     OPEN INPUT ITEMN.
003012*-- If file does not exist, just continue on --*
003013     If ITEMN-STATUS = NO-FILE
003014        NEXT SENTENCE
003015     ELSE
003016     If C-Found of ItemN-Status or ItemN-Status = "39"
003017*-- If file is found, ask user if it should be overwritten --*
003018        PERFORM NEW-FILE-ALREADY-EXISTS
003019        IF ReturnValue = Pow-DMRNo
003020           Move Zero   to Grid-Index
003021           MOVE "ITEM" TO Grid-Filename
003022           Move spaces to Grid-Comment
003023           string ItemN-fullpath     delimited by space
003024                  " - Exists, Conversion Aborted by User." delimited by size
003025                  into Grid-Comment
003026           PERFORM ADD-GRID-LINE
003027           Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
003028           Add 1 to Conv-Error-Cnt
003029           Go to End-Program
003030        ELSE
003031           Move Zero   to Grid-Index
003032           MOVE "ITEM" TO Grid-Filename
003033           Move spaces to Grid-Comment
003034           string ItemN-fullpath     delimited by space
003035                  " - File will be overwritten." delimited by size
003036                  into Grid-Comment
003037           PERFORM ADD-GRID-LINE
003038           Move Pow-Color-Yellow to "ItemBackColor"(grid-index) OF ctGridResults
003039     Else
003040         Perform New-File-Other-Error
003041         Move Spaces to Grid-Comment
003042         String ItemN-FullPath         delimited by spaces
003043                " - Error = "          delimited by size
003044                ItemN-Status           delimited by size
003045                into Grid-Comment
003046         Perform Add-Grid-Line
003047         Add 1 to Conv-Error-Cnt
003048         Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults.
003049         
003050                   
003051     OPEN INPUT ITEMO.
003052*-- The file to be converted does not exist, Abort the conversion --*
003053     IF ITEMO-STATUS = NO-FILe
003054        MOVE "The file to be converted was not found." TO OLD-FILE-MSG
003055        PERFORM OLD-FILE-ERROR-MSG
003056        Move Zero   to Grid-Index
003057        Move spaces to Grid-Comment
003058        string ItemO-fullpath     delimited by space
003059               " - Not Found, Conversion Aborted.    " delimited by size
003060               into Grid-Comment
003061        PERFORM ADD-GRID-LINE
003062        Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
003063         Add 1 to Conv-Error-Cnt
003064        Go to End-Program.
003065
003066*-- The file was found, but is not the correct starting layout (structure) --*
003067     IF ITEMO-STATUS = STRUCTURE-MISMATCH
003068        MOVE "Wrong Starting version of this file." TO OLD-FILE-MSG
003069        PERFORM OLD-FILE-ERROR-MSG
003070        Move Zero   to Grid-Index
003071        Move spaces to Grid-Comment
003072        string ItemO-fullpath     delimited by space
003073               " - Wrong Starting Structure, Conversion Aborted.    " delimited by size
003074               into Grid-Comment
003075        PERFORM ADD-GRID-LINE
003076        Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
003077         Add 1 to Conv-Error-Cnt
003078        Go to End-Program.
003079    
003080*-- The file was found, but it appears to be corrupted --*
003081     IF ITEMO-STATUS = PERMANENT-ERROR
003082        MOVE "The file seems to be corrupted." TO OLD-FILE-MSG
003083        PERFORM OLD-FILE-Error-Msg
003084        Move Zero   to Grid-Index
003085        Move spaces to Grid-Comment
003086        string ItemO-fullpath     delimited by space
003087               " - Corrupted, Try rebuilding it. Conversion Aborted.    " delimited by size
003088               into Grid-Comment
003089        PERFORM ADD-GRID-LINE
003090        Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
003091         Add 1 to Conv-Error-Cnt
003092        Go to End-Program.
003093
003094  
003095 File-Tests-Passed.                   
003096     Move Spaces to Grid-Comment.
003097     String "Converting - "          delimited by size
003098            itemo-fullpath           delimited by space
003099            into Grid-Comment.
003100     perform Add-Grid-Line.
003101     Open Output ItemN.
003102     
003103 START-DATA-CONVERSION.
003104     PERFORM  PROCESS-RECORD UNTIL ITEMO-STATUS NOT = FOUND.
003105     CLOSE ITEMO, ITEMN.
003106
003107 Update-Grid-With-Counts.
003108     Move Rec-Read-Cnt to Dsp-Read-Cnt.
003109     Move Rec-Write-Cnt to Dsp-Write-Cnt.
003110     Move Rec-Error-Cnt to Dsp-Error-Cnt.
003111     Move Counts-Line to Grid-Comment.
003112     Perform Add-Grid-Line.
003113       
003114 RENAME-FILES.
003115     If "Value" OF CmCheckSaveOrg = Pow-Tristate-Checked
003116        Perform Save-Original-File
003117        If Cbl_Status_Code not = Zero
003118           Move "ITEM File Conversion Aborted" to Grid-Comment
003119           Perform ADD-GRID-LINE
003120           Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
003121           Add 1 to Conv-Error-Cnt
003122           Go To End-Program
003123        else
003124           Perform Delete-Original-File
003125           If Cbl_Status_Code not = Zero
003126              Move "Original File Delete Failed" to Grid-Comment
003127              Perform ADD-GRID-LINE
003128              Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
003129              Move "Item File Conversion Aborted" to Grid-Comment
003130              Perform ADD-GRID-LINE
003131              Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
003132              Add 1 to Conv-Error-Cnt
003133              Go To End-Program
003134           else
003135              Next Sentence
003136     Else
003137        Perform Delete-Original-File
003138        If Cbl_Status_Code not = Zero
003139           Move "Original File Delete Failed" to Grid-Comment
003140           Perform ADD-GRID-LINE
003141           Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
003142           Move "Item File Conversion Aborted" to Grid-Comment
003143           Perform ADD-GRID-LINE
003144           Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
003145           Add 1 to Conv-Error-Cnt
003146           Go To End-Program.
003147        
003148     Perform Rename-New-File.    
003149     IF CBL_STATUS_CODE NOT = ZERO
003150        Move "RENAME .V44 TO .FIL Failed" to Grid-Comment
003151        Perform ADD-GRID-LINE
003152        Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
003153        Move "Item File Conversion Aborted" to Grid-Comment
003154        Perform ADD-GRID-LINE
003155        Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
003156         Add 1 to Conv-Error-Cnt
003157        Go To End-Program.
003158     
003159 FINISHED-CONVERSION.
003160        Move "Item File Conversion Successful" to Grid-Comment.
003161        Perform ADD-GRID-LINE.
003162        Move Pow-Color-Green to "ItemBackColor"(grid-index) OF ctGridResults.
003163     
003164 END-PROGRAM.
003165     EXIT PROGRAM.     
003166
003167 SUBROUTINE SECTION.
003168 STRING-FILENAMES.     
003169       MOVE SPACES TO ITEMO-FULLPATH.
003170       String  Profits-Programs-Loc   delimited by space
003171               "\"                    DELIMITED BY SIZE
003172               Profits-Data-Loc       delimited by space
003173               "\"                    DELIMITED BY SIZE
003174               ITEMO--NAME            DELIMITED BY SPACE
003175               INTO ITEMO-FULLPATH.
003176
003177       MOVE SPACES TO ITEMN-FULLPATH.
003178       String  Profits-Programs-Loc   delimited by space
003179               "\"                    DELIMITED BY SIZE
003180               Profits-Data-Loc       delimited by space
003181               "\"                    DELIMITED BY SIZE
003182               ITEMN--NAME             DELIMITED BY SPACE
003183               INTO ITEMN-FULLPATH.
003184 ADD-GRID-LINE.
003185*     Move Pow-Color-Black to "ItemBackColor"(grid-index) OF ctGridResults.
003186     move zero to Grid-Index.
003187     INVOKE ctGridResults "InsertItem" USING Grid-Comment Grid-Index RETURNING ReturnValue.
003188
003189
003190 New-File-Already-Exists.
003191      If C-found of ItemN-Status
003192         close itemN.
003193      Move zero       to Msg-Style.
003194      Add Pow-DMYesNo to Msg-Style.
003195      Add Pow-DMIconQuestion to Msg-Style.
003196      INVOKE Pow-Self "DisplayMessage" 
003197             USING Ws-File-Exists-Msg
003198                   "Profits Warning"
003199                   msg-style
003200             RETURNING ReturnValue.
003201
003202 New-File-Other-Error.
003203      Move zero    to Msg-Style.
003204      Add Pow-DMOK to Msg-Style.
003205      Add Pow-DMIconExclamation to Msg-Style.
003206      INVOKE Pow-Self "DisplayMessage" 
003207             USING Ws-new-File-Error-Msg
003208                   "Profits Warning"
003209                   msg-style
003210             RETURNING ReturnValue.
003211
003212 OLD-File-Error-Msg.
003213      Move zero        to Msg-Style.
003214      Add Pow-DMOK     to Msg-Style.
003215      Add Pow-DMIconExclamation to Msg-Style.
003216      INVOKE Pow-Self "DisplayMessage" 
003217             USING Ws-Old-file-Error-msg
003218                   "Profits Warning"
003219                   msg-style
003220             RETURNING ReturnValue.
003221             
003222 PROCESS-RECORD.
003223         PERFORM READ-ITEMO.
003224         IF C-FOUND OF ITEMO-STATUS
003225            PERFORM MOVE-DATA
003226            PERFORM WRITE-ITEMN.
003227
003228      MOVE REC-READ-CNT                TO "Value" OF ctNEditReadCnt.
003229      MOVE REC-WRITE-CNT               TO "Value" OF ctNEditWriteCnt.
003230      MOVE REC-ERROR-CNT               TO "Value" OF ctNEditErrorCnt.
003231      MOVE Conv-ERROR-CNT              TO "Value" OF ctNEditConvCnt.
003232      INVOKE POW-SELF "Refresh".
003233
003234 MOVE-DATA.  
003235
003236      MOVE ITEMO-REC                 TO ITEMN-REC.
003237      MOVE SPACES TO ITEM-ALT-NUMBER OF ITEMN-REC.
003238      IF ITEM-WHSE-NO OF ITEMO-REC NOT = SPACES
003239         STRING ITEM-NUMBER  OF ITEMO-REC DELIMITED BY SIZE
003240                ITEM-WHSE-NO OF ITEMO-REC DELIMITED BY SIZE
003241                INTO ITEM-ALT-NUMBER OF ITEMN-REC
003242      ELSE
003243         MOVE ITEM-NUMBER OF ITEMO-REC  TO ITEM-ALT-NUMBER OF ITEMN-REC.
003244      MOVE ZERO                      TO ITEM-LAST-COST-VEND1 OF ITEMN-REC
003245                                        ITEM-LAST-COST-VEND2 OF ITEMN-REC
003246                                        ITEM-LAST-COST-VEND3 OF ITEMN-REC.
003247      MOVE 2                         TO ITEM-ROLL-TRACKING-CD.
003248      MOVE SPACE                     TO ITEM-FILLER OF ITEMN-REC.
003249      
003250
003251 Save-Original-File.
003252      MOVE ITEMO-FULLPATH  TO CBL_FROM_PATH, CBL_TO_PATH.
003253      INSPECT CBL_TO_PATH REPLACING FIRST ".FIL" BY ".ORG".
003254      CALL "CBL_COPY_FILE"
003255           USING CBL_FROM_PATH CBL_TO_PATH 
003256           RETURNING CBL_STATUS_CODE.
003257      IF CBL_STATUS_CODE NOT = ZERO
003258         MOVE CBL_STATUS_CODE TO WS-ERROR-CODE
003259         MOVE SPACES TO GRID-COMMENT
003260         STRING "Error = "         DELIMITED BY size
003261                WS-ERROR-CODE      DELIMITED BY SIZE
003262                " - Save Original Failed" delimited by size
003263                into Grid-Comment
003264         perform ADD-GRID-LINE
003265         Add 1 to Conv-Error-Cnt
003266         Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults.
003267      
003268 Delete-Original-File.
003269      MOVE ITEMO-FULLPATH  TO CBL_FROM_PATH.
003270      Call "CBL_DELETE_FILE"
003271           using CBL_From_Path
003272           Returning CBL_Status_Code.
003273           
003274 Rename-New-File.
003275      MOVE ITEMN-FULLPATH TO CBL_TO_PATH, CBL_FROM_PATH.
003276      INSPECT CBL_TO_PATH REPLACING FIRST ".V45" BY ".FIL".
003277      CALL "CBL_RENAME_FILE"
003278           USING CBL_FROM_PATH CBL_TO_PATH
003279           RETURNING CBL_STATUS_CODE.
003280          
003281      
003282 SUBROUTINE-EXIT. EXIT.     
003283 
003284  IN-OUT SECTION.
003285  START-ITEMO.
003286     START ITEMO KEY IS NOT < ITEM-NUMBER-KEY OF ITEMO-REC
003287         INVALID KEY MOVE ITEMO-STATUS TO ITEMO-STATUS.
003288         
003289  READ-ITEMO.
003290     READ ITEMO NEXT
003291         AT END MOVE AT-END TO ITEMO-STATUS.
003292     IF C-FOUND OF ITEMO-STATUS
003293        ADD 1 TO REC-READ-CNT. 
003294            
003295  WRITE-ITEMN.
003296     WRITE ITEMN-REC
003297         INVALID KEY MOVE ITEMN-STATUS TO ITEMN-STATUS.
003298     IF C-FOUND OF ITEMN-STATUS
003299        ADD 1 TO REC-WRITE-CNT
003300     ELSE
003301        Move ItemN-Status to DSP-Error-Code
003302        move ItemN-Key    to Dsp-Error-Key
003303        move Error-Line to Grid-Comment
003304        Perform Add-Grid-Line
003305         Add 1 to Conv-Error-Cnt
003306        Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults
003307        ADD 1 TO REC-ERROR-CNT.     
003308         
003309  IN-OUT-EXIT. EXIT. 
003310*</SCRIPT>
003311 END PROGRAM     ProcConvertItemF.
003312 IDENTIFICATION  DIVISION.
003313* ProcFindCurrSubDir.
003314 PROGRAM-ID.     ProcFindCurrSubDir IS COMMON.
003315*<SCRIPT DIVISION="PROCEDURE", NAME="ProcFindCurrSubDir">
003316 ENVIRONMENT     DIVISION.
003317 DATA            DIVISION.
003318 WORKING-STORAGE SECTION.
003319 77  Max-Index                    Pic s9(4) comp-5.
003320 77  Company-Index                Pic s9(9) Comp-5.
003321 77  Combo-Index                  Pic s9(9) Comp-5.
003322 77  Ws-Tab                       PIC X Value "~".
003323 77  Ws-Company-Name              Pic X(40)  Value spaces.
003324 77  Ws-SubFolder                 Pic x(08)  Value spaces.
003325
003326 PROCEDURE       DIVISION.
003327 BEGIN-PROGRAM.
003328     Move Ws-Tab to  "BreakChar" OF ctComboCompanyFolder.
003329     Move zero to Company-Index.
003330     INVOKE ctComboCompanyFolder "ListCount" RETURNING ReturnValue.
003331     COMPUTE Max-Index = ReturnValue - 1.
003332
003333     Perform Find-Current-Company Varying Combo-Index from 0 by 1
003334             until Combo-Index > Max-Index.
003335     Move Company-Index  to "ListIndex" OF ctComboCompanyFolder.
003336 END-PROGRAM.
003337     EXIT PROGRAM.
003338     
003339 Find-Current-Company.           
003340     MOVE "ListText"(Combo-Index) OF ctComboCompanyFolder to TextF-Rec.
003341     UNSTRING TEXTF-REC DELIMITED BY WS-TAB
003342              INTO      WS-COMPANY-NAME
003343                        WS-SUBFOLDER.
003344     If Ws-Subfolder = User-Sub-Dir
003345        MOVE Combo-Index TO COMPANY-INDEX.
003346          
003347*</SCRIPT>
003348 END PROGRAM     ProcFindCurrSubDir.
003349 IDENTIFICATION  DIVISION.
003350* ProcReadCompanyTxt.
003351 PROGRAM-ID.     ProcReadCompanyTxt IS COMMON.
003352*<SCRIPT DIVISION="PROCEDURE", NAME="ProcReadCompanyTxt">
003353 ENVIRONMENT     DIVISION.
003354 DATA            DIVISION.
003355 WORKING-STORAGE SECTION.
003356 77  File-name                    pic x(100).
003357 77  File-Status                  pic xx.
003358 77  ReturnValue                  Pic s9(4) comp-5.
003359 77  Ws-Tab                       PIC X Value "~".
003360
003361 
003362 PROCEDURE       DIVISION.
003363 DECLARATIVES.
003364 Z-TEXTF SECTION.
003365     USE AFTER ERROR PROCEDURE ON TEXTF.
003366 Z-TEXTF-DECLAR.
003367      MOVE TEXTF-FULLPATH  TO FILE-NAME.
003368      MOVE TEXTF-STATUS    TO FILE-STATUS.
003369      PERFORM STATUS-CHECK THRU STATUS-EXIT.
003370** ADD LOGIC TO CALL ERROR MESSAGE ROUTINE HERE **      
003371     GO TO STATUS-EXIT.
003372
003373**     COPY "DECLAR.SR".
003374 STATUS-CHECK.
003375           IF FILE-STATUS = RECORD-LOCK OR DUPLICATE-RECORD
003376              GO TO STATUS-EXIT.
003377
003378           SET DBIO OF ERROR-KIND TO TRUE.
003379           MOVE FILE-NAME        TO ERROR-DBIO.
003380           MOVE FILE-STATUS      TO IOSTATUS OF ERROR-DBIO.
003381           MOVE "45CONVERT.EXE"    TO ERROR-PROGRNAME.
003382           INVOKE POW-SELF "CallForm" USING "DBIOERROR" "ERRORBOX"
003383                 RETURNING ReturnValue.
003384           INVOKE POW-SELF "CloseForm" USING "ProfitsConversion"
003385                 RETURNING ReturnValue.
003386**********INVOKE Pow-self "Deactivate" RETURNING ReturnValue   
003387           EXIT PROGRAM.
003388
003389 STATUS-EXIT. EXIT.       
003390     
003391 END DECLARATIVES. 
003392
003393 Begin-Program.   
003394     Move Ws-Tab to  "BreakChar" OF ctComboCompanyFolder
003395     Move "\Profits\Company.Ini"   to TextF-Fullpath.
003396     Perform Open-TextF.
003397
003398 Read-Company-Data.
003399     INVOKE ctComboCompanyFolder "ClearList". 
003400     Perform Read-TextF-Next until TextF-Status = "10".
003401**     Move Pow-True to "Sorted" OF ctComboCompanyFolder.
003402     Close TextF.
003403     
003404 End-Program.
003405     Exit Program.
003406
003407 Open-TextF.
003408     Open Input TextF.
003409
003410 Read-TextF-Next.
003411     Read TextF
003412          At End Move At-End to Textf-Status.         
003413     If TextF-Status = Found
003414        IF TextF-Rec Not = Spaces
003415           INVOKE ctComboCompanyFolder "AddItem" USING TextF-Rec RETURNING ReturnValue
003416           Move TextF-Rec to "StatusText" OF Pow-Self.
003417           
003418                 
003419     
003420*</SCRIPT>
003421 END PROGRAM     ProcReadCompanyTxt.
003422 IDENTIFICATION  DIVISION.
003423* ProcInitControls.
003424 PROGRAM-ID.     ProcInitControls IS COMMON.
003425*<SCRIPT DIVISION="PROCEDURE", NAME="ProcInitControls">
003426 ENVIRONMENT     DIVISION.
003427 DATA            DIVISION.
003428 WORKING-STORAGE SECTION.
003429 01  ws-back-color                pic s9(9) comp-5 value ZERO.
003430 01  BACK-COLOR REDEFINES WS-BACK-COLOR   PIC X(4).
003431 
003432 PROCEDURE       DIVISION.
003433     Move Pow-False to "Enabled" OF ctPushConvert.
003434     Move "Locating Company Data Files, Please Wait...." TO "StatusText" OF Pow-Self.
003435     MOVE X"5580AA00"  TO BACK-COLOR.
003436     MOve WS-BACK-COLOR   TO 
003437                             "BackColor" OF ctFrame1
003438                             "BackColor" OF ctGroup1
003439                             "BackColor" OF ctGroupResults
003440                             "BackColor" OF CmCheckItemFile
003441                             "BackColor" OF CmCheckChrtFile
003442                             "BackColor" OF CmCheckPoHdFile
003443                             "BackColor" OF CmCheckItrnFile
003444                             "BackColor" OF CmCheckOrdlFile
003445                             "BackColor" OF CmCheckStylFile
003446                             "BackColor" OF CmCheckMUCTFile
003447                             "BackColor" OF CmCheckSaveOrg
003448                             "BackColor" OF CmStaticFolderName
003449                             "BackColor" OF CmStaticMultiWhse
003450                             "RoundColor" OF ctPushDeSelectAll
003451                             "RoundColor" OF ctPushSelectAll
003452                             "RoundColor" OF ctPushExit
003453                             "RoundColor" OF ctPushConvert
003454                             .
003455     MOVE X"FF008000"  TO BACK-COLOR.
003456     Move WS-BACK-COLOR  TO
003457                             "FocusColor" OF ctPushDeSelectAll                             
003458                             "FocusColor" OF ctPushSelectAll
003459                             "FocusColor" OF ctPushExit
003460                             "FocusColor" OF ctPushConvert
003461                             .
003462     Move Pow-False   to     "Value" OF CmCheckItemFile
003463                             "Value" OF CmCheckChrtFile
003464                             "Value" OF CmCheckPoHdFile
003465                             "Value" OF CmCheckItrnFile
003466                             "Value" OF CmCheckOrdlFile
003467                             "Value" OF CmCheckStylFile
003468                             "Value" OF CmCheckMUCTFile
003469                             .
003470     Move spaces to "Caption" OF ctTextCurrStatus.    
003471*</SCRIPT>
003472 END PROGRAM     ProcInitControls.
003473 IDENTIFICATION  DIVISION.
003474* ProcEnableAutoCloseTimer.
003475 PROGRAM-ID.     ProcEnableAutoCloseTimer IS COMMON.
003476*<SCRIPT DIVISION="PROCEDURE", NAME="ProcEnableAutoCloseTimer">
003477 ENVIRONMENT     DIVISION.
003478 DATA            DIVISION.
003479 WORKING-STORAGE SECTION.
003480 77  WS-REMAINDER           PIC 99V99999  COMP-5.
003481 77  CURR-SECONDS           PIC 9(5) COMP-5.
003482 77  ALARM-SECONDS           PIC 9(5) COMP-5.
003483 
003484 PROCEDURE       DIVISION.
003485*-- debug --
003486*     Move 23   to "CurrentHour" OF ctclockautoclose.
003487*     Move 59   to "CurrentMinute" OF ctclockautoclose.
003488*     Move 00   to "CurrentSecond" OF ctclockautoclose
003489     Move Pow-True to "Enabled" OF ctClockAutoClose.     
003490     Move Zero to "ClockType" OF ctClockAutoClose.
003491     Move "CurrentHour"   OF ctClockAutoClose  to Ws-Close-Hour.
003492     Move "CurrentMinute" OF ctClockAutoClose  to Ws-Close-Min.
003493     mOVE "CurrentSecond" OF ctClockAutoClose  TO WS-Close-Sec.
003494     COMPUTE CURR-SECONDS ROUNDED = (((WS-CLOSE-HOUR * 60) + 
003495         WS-CLOSE-MIN) * 60) + WS-CLOSE-SEC.
003496     ADD WS-AUTO-CLOSE-DELAY-SECONDS TO CURR-SECONDS 
003497         GIVING ALARM-SECONDS.
003498     DIVIDE ALARM-SECONDS BY 60 GIVING WS-CLOSE-MIN
003499         REMAINDER WS-CLOSE-SEC.
003500
003501     IF Ws-Close-MIN = ZERO
003502        MOVE ZERO TO WS-Close-Hour
003503     ELSE
003504        DIVIDE WS-CLOSE-MIN BY 60 GIVING WS-CLOSE-HOUR 
003505           REMAINDER WS-CLOSE-MIN.
003506     If Ws-Close-Hour = 24 
003507        Move zero to Ws-close-hour.
003508
003509     MOVE WS-CLOSE-HOUR TO "AlarmHour"  OF ctClockAutoClose, "CurrentHour" OF ctClockAlarmTime.
003510     MOVE WS-CLOSE-MIN TO "AlarmMinute" OF ctClockAutoClose, "CurrentMinute" OF ctClockAlarmTime.
003511     mOVE WS-CLOSE-SEC TO "AlarmSecond" OF ctClockAutoClose, "CurrentSecond" OF ctClockAlarmTime.
003512     Move Pow-True to "Enabled" OF ctClockAutoClose.     
003513*</SCRIPT>
003514 END PROGRAM     ProcEnableAutoCloseTimer.
003515 IDENTIFICATION  DIVISION.
003516* ProcLoadScrnHeaderInfo.
003517 PROGRAM-ID.     ProcLoadScrnHeaderInfo IS COMMON.
003518*<SCRIPT DIVISION="PROCEDURE", NAME="ProcLoadScrnHeaderInfo">
003519 ENVIRONMENT     DIVISION.
003520 DATA            DIVISION.
003521 WORKING-STORAGE SECTION.
003522  01  System-Date-YMD           Pic x(6).
003523  01  System-Date.
003524      05   System-Day           Pic 9(2).
003525      05   Filler               PIC X      Value  "/".
003526      05   System-Month         PIc 9(2).
003527      05   Filler               PIC X(3)   Value  "/20".
003528      05   System-Year          pic 9(2).
003529      
003530 PROCEDURE       DIVISION.
003531     Accept System-Date-YMD from Date.
003532     Move System-Date-YMD(3:2)        to System-Month.
003533     Move System-date-YMD(5:2)        to System-Day
003534     Move System-date-YMD(1:2)        to System-Year.
003535     Move system-date           to  "Text" OF ctDEditSystemDate.
003536     
003537     Move Cntl-Coname-Rt        to CoName-Rt.
003538*     Move Company-Name-Line     to "Caption" OF StaticCoName.
003539     MOVE SPACES                TO "Caption" OF StaticCoName.
003540         
003541     Move "File Conversions - v4.4 to v4.5" to "Caption" OF StaticMenuOptionName.
003542     
003543     Move "4.5.0"               to Version-NO.
003544     Move User-SN               to Serial-No.
003545     Move User-TermId           to Station-No.
003546     Move User-Userid           to Username.
003547     Move Version-Info-Line     to "Caption" OF StaticVersionSNInfo.
003548     Move User-Info-Line        to "Caption" OF StaticUserID.
003549*</SCRIPT>
003550 END PROGRAM     ProcLoadScrnHeaderInfo.
003551 IDENTIFICATION  DIVISION.
003552* ProcReadCntlFile.
003553 PROGRAM-ID.     ProcReadCntlFile IS COMMON.
003554*<SCRIPT DIVISION="PROCEDURE", NAME="ProcReadCntlFile">
003555 ENVIRONMENT     DIVISION.
003556 DATA            DIVISION.
003557 WORKING-STORAGE SECTION.
003558 PROCEDURE       DIVISION.
003559 DECLARATIVES.
003560     COPY "CNTLF.DS".
003561     GO TO STATUS-EXIT.
003562        
003563 STATUS-CHECK.
003564           IF FILE-STATUS = RECORD-LOCK OR DUPLICATE-RECORD
003565              GO TO STATUS-EXIT.
003566
003567           SET DBIO OF ERROR-KIND TO TRUE.
003568           MOVE FILE-NAME        TO ERROR-DBIO.
003569           MOVE FILE-STATUS      TO IOSTATUS OF ERROR-DBIO.
003570           MOVE "45CONVERT.EXE"    TO ERROR-PROGRNAME.
003571           INVOKE POW-SELF "CallForm" USING "DBIOERROR" "ERRORBOX"
003572                 RETURNING ReturnValue.
003573           INVOKE POW-SELF "CloseForm" USING "ProfitsConversion"
003574                 RETURNING ReturnValue.
003575           EXIT PROGRAM.
003576           
003577 STATUS-EXIT. EXIT.       
003578 END DECLARATIVES. 
003579 BEGIN-PROGRAM.
003580*     call "ProcCheckCntlF".
003581     OPEN INPUT CNTLF.
003582     Read CNTLF 
003583         Invalid key Move Cntlf-Status to Cntlf-Status.
003584     IF MULTI-WHSE
003585        MOVE   "Yes" to "Text" OF CmTextMultiWhse
003586     ELSE
003587        MOVE   "No" to "Text" OF CmTextMultiWhse.
003588 END-PROGRAM.
003589     EXIT PROGRAM.
003590              
003591         
003592*</SCRIPT>
003593 END PROGRAM     ProcReadCntlFile.
003594 IDENTIFICATION  DIVISION.
003595* ProcBeginLogic.
003596 PROGRAM-ID.     ProcBeginLogic IS COMMON.
003597*<SCRIPT DIVISION="PROCEDURE", NAME="ProcBeginLogic">
003598 ENVIRONMENT     DIVISION.
003599 DATA            DIVISION.
003600 WORKING-STORAGE SECTION.
003601 PROCEDURE       DIVISION.
003602 BEGIN-PROGRAM.
003603*     Call "ProcCheckUserF".
003604     Call "ProcOpenUserFile".
003605     iF IOSTATUS OF ERROR-DBIO NOT = FOUND
003606        GO TO END-PROGRAM.
003607     Call "ProcReadUserFile".
003608     iF IOSTATUS OF ERROR-DBIO NOT = FOUND
003609        GO TO END-PROGRAM.
003610*-     Call "ProcOpenFiles".
003611*-     iF IOSTATUS OF ERROR-DBIO NOT = FOUND
003612*-        GO TO END-PROGRAM.
003613*-     Call "ProcReadCntlFile".
003614*-     iF IOSTATUS OF ERROR-DBIO NOT = FOUND
003615*-        GO TO END-PROGRAM.
003616*-     CLOSE CNTLF, USERF.
003617     CLOSE USERF.
003618     Call "ProcLoadScrnHeaderInfo".
003619     Call "ProcReadCompanyTxt".
003620     Call "ProcFindCurrSubDir". 
003621     move spaces to "StatusText" OF pow-self.    
003622 END-PROGRAM.
003623     EXIT PROGRAM.     
003624*</SCRIPT>
003625 END PROGRAM     ProcBeginLogic.
003626 IDENTIFICATION  DIVISION.
003627* ProcOpenFiles.
003628 PROGRAM-ID.     ProcOpenFiles IS COMMON.
003629*<SCRIPT DIVISION="PROCEDURE", NAME="ProcOpenFiles">
003630 ENVIRONMENT     DIVISION.
003631 DATA            DIVISION.
003632 WORKING-STORAGE SECTION.
003633 PROCEDURE       DIVISION.
003634 DECLARATIVES.
003635     COPY "CNTLF.DS".
003636     GO TO STATUS-EXIT.
003637        
003638 STATUS-CHECK.
003639           IF FILE-STATUS = RECORD-LOCK OR DUPLICATE-RECORD
003640              GO TO STATUS-EXIT.
003641
003642           SET DBIO OF ERROR-KIND TO TRUE.
003643           MOVE FILE-NAME        TO ERROR-DBIO.
003644           MOVE FILE-STATUS      TO IOSTATUS OF ERROR-DBIO.
003645           MOVE "45CONVERT.EXE"    TO ERROR-PROGRNAME.
003646           INVOKE POW-SELF "CallForm" USING "DBIOERROR" "ERRORBOX"
003647                 RETURNING ReturnValue.
003648           INVOKE POW-SELF "CloseForm" USING "ProfitsConversion"
003649                 RETURNING ReturnValue.
003650           EXIT PROGRAM.
003651
003652 STATUS-EXIT. EXIT.       
003653 END DECLARATIVES. 
003654 BEGIN-PROGRAM.     
003655*-- Control File --*
003656     COPY "CNTLF.SR".
003657     MOVE PROFITS-DATA-LOC  TO "Text" OF CmTextFolder.
003658  
003659 Open-Files.
003660*-     Open INPUT Cntlf.
003661 
003662 
003663     Exit Program.             
003664*</SCRIPT>
003665 END PROGRAM     ProcOpenFiles.
003666 IDENTIFICATION  DIVISION.
003667* ProcReadUserFile.
003668 PROGRAM-ID.     ProcReadUserFile IS COMMON.
003669*<SCRIPT DIVISION="PROCEDURE", NAME="ProcReadUserFile">
003670 ENVIRONMENT     DIVISION.
003671 DATA            DIVISION.
003672 WORKING-STORAGE SECTION.
003673 PROCEDURE       DIVISION.
003674 DECLARATIVES.
003675     COPY "USERF.DS".
003676     GO TO STATUS-EXIT.
003677        
003678 STATUS-CHECK.
003679           IF FILE-STATUS = RECORD-LOCK OR DUPLICATE-RECORD
003680              GO TO STATUS-EXIT.
003681
003682           SET DBIO OF ERROR-KIND TO TRUE.
003683           MOVE FILE-NAME        TO ERROR-DBIO.
003684           MOVE FILE-STATUS      TO IOSTATUS OF ERROR-DBIO.
003685           MOVE "45CONVERT.EXE"    TO ERROR-PROGRNAME.
003686           INVOKE POW-SELF "CallForm" USING "DBIOERROR" "ERRORBOX"
003687                 RETURNING ReturnValue.
003688           INVOKE POW-SELF "CloseForm" USING "ProfitsConversion"
003689                 RETURNING ReturnValue.
003690           EXIT PROGRAM.
003691           
003692 STATUS-EXIT. EXIT.       
003693 END DECLARATIVES. 
003694     Call "ProcGetTermId".
003695     Read UserF Key is Userf-Key
003696         Invalid Key Move UserF-STATUS to Userf-STATUS.
003697     Move User-sub-dir  to Profits-Data-Loc. 
003698     
003699* Temp *
003700*     Move "MEI"  to Profits-Data-Loc.
003701*     Move "Ksiler" to User-Userid.
003702*     Move 2        to User-termid.
003703*     Move 00152    to User-SN.
003704            
003705        
003706*</SCRIPT>
003707 END PROGRAM     ProcReadUserFile.
003708 IDENTIFICATION  DIVISION.
003709* ProcGetTermId.
003710 PROGRAM-ID.     ProcGetTermId IS COMMON.
003711*<SCRIPT DIVISION="PROCEDURE", NAME="ProcGetTermId">
003712 ENVIRONMENT     DIVISION.
003713 DATA            DIVISION.
003714     
003715 WORKING-STORAGE SECTION.
003716 01  Term-id-alpha.
003717     05  Term-IP-Addr              Pic x(62).
003718     05  Term-ID-Aport             Pic x(2).
003719 PROCEDURE       DIVISION.
003720     MOVE ZERO TO TERM-ID-ALPHA.
003721     Call "TermID" using Term-ID-Alpha.
003722     Move Term-Id-Alpha   to userf-key.
003723       
003724*</SCRIPT>
003725 END PROGRAM     ProcGetTermId.
003726 IDENTIFICATION  DIVISION.
003727* ProcOpenUserFile.
003728 PROGRAM-ID.     ProcOpenUserFile IS COMMON.
003729*<SCRIPT DIVISION="PROCEDURE", NAME="ProcOpenUserFile">
003730 ENVIRONMENT     DIVISION.
003731 DATA            DIVISION.
003732 WORKING-STORAGE SECTION.
003733 PROCEDURE       DIVISION.
003734 DECLARATIVES.
003735     COPY "USERF.DS".
003736     GO TO STATUS-EXIT.
003737        
003738 STATUS-CHECK.
003739           IF FILE-STATUS = RECORD-LOCK OR DUPLICATE-RECORD
003740              GO TO STATUS-EXIT.
003741
003742           SET DBIO OF ERROR-KIND TO TRUE.
003743           MOVE FILE-NAME        TO ERROR-DBIO.
003744           MOVE FILE-STATUS      TO IOSTATUS OF ERROR-DBIO.
003745           MOVE "45CONVERT.EXE"    TO ERROR-PROGRNAME.
003746           INVOKE POW-SELF "CallForm" USING "DBIOERROR" "ERRORBOX"
003747                 RETURNING ReturnValue.
003748           INVOKE POW-SELF "CloseForm" USING "ProfitsConversion"
003749                 RETURNING ReturnValue.
003750           EXIT PROGRAM.
003751           
003752 STATUS-EXIT. EXIT.       
003753 END DECLARATIVES. 
003754 BEGIN-PROGRAM.
003755     COPY "USERF.SR".           
003756     Open I-O UserF.
003757
003758 END-PROGRAM.
003759     EXIT PROGRAM.     
003760     
003761*</SCRIPT>
003762 END PROGRAM     ProcOpenUserFile.
003763 IDENTIFICATION  DIVISION.
003764* ProcInitializeVariables.
003765 PROGRAM-ID.     ProcInitializeVariables IS COMMON.
003766*<SCRIPT DIVISION="PROCEDURE", NAME="ProcInitializeVariables">
003767 ENVIRONMENT     DIVISION.
003768 DATA            DIVISION.
003769 WORKING-STORAGE SECTION.
003770 PROCEDURE       DIVISION.
003771 BEGIN-PROGRAM.
003772     MOVE "00" TO IOSTATUS OF ERROR-DBIO.
003773     Move spaces to CntlF-status, Userf-Status.
003774     Move 1      to Cntlf-Key.
003775     Move "\Profits" to Profits-Programs-Loc.
003776*     Move Pow-True to  "StartTimer" OF ctClockAutoClose.
003777     MOVE 2      TO ERRORS-FOUND-CD.
003778     
003779       
003780*</SCRIPT>
003781 END PROGRAM     ProcInitializeVariables.
003782 IDENTIFICATION  DIVISION.
003783* ctPushConvert-Click.
003784 PROGRAM-ID.     POW-SCRIPTLET1.
003785*<SCRIPT DIVISION="PROCEDURE", CONTROL="ctPushConvert", EVENT="Click", POW-NAME="SCRIPTLET1", TYPE="ETC">
003786 ENVIRONMENT     DIVISION.
003787 DATA            DIVISION.
003788 WORKING-STORAGE SECTION.
003789 01  Grid-Comment                 Pic x(50)           Value spaces.
003790 01  Grid-Index                   Pic s9(9)  Comp-5   Value zero.
003791 01  WS-MSG-STYLE                 PIC S9(9)  COMP-5   VALUE ZERO.
003792 01  WS-Errors-Found-Msg.
003793     05 Filler                    PIC x(40)
003794            Value is "Errors were found during the conversion!".
003795     05 FILLER                    PIC X(2)   VALUE X"0A0A".
003796     05 FILLER                    PIC x(45)
003797            VALUE IS "Please scroll thru the Results Error List".
003798     05 Filler                    pic x(1)   value X"0A".
003799     05 Filler                     PIC x(40)
003800            Value is "to review the errors.".
003801     05 Filler                    Pic X(1)   Value X"0A".
003802 01  Ws-Date-11                  pic x(11)  Value Spaces.
003803 01  WS-TIME.
003804     05  WS-HOUR                 PIC 9(02)  VALUE ZEROES.
003805     05  WS-MIN                  PIC 9(02)  VALUE ZEROES.
003806     05  WS-SEC                  PIC 9(02)  VALUE ZEROES.
003807     05  WS-HUND                 PIC 9(02)  VALUE ZEROES.
003808 01  Ws-Time-08.   
003809     05  WS-time-hour            PIC 9(02)  VALUE ZEROES.
003810     05  filler                  pic x      value ":".
003811     05  WS-time-min             PIC 9(02)  VALUE ZEROES.
003812     05  filler                  pic x      value ":".
003813     05  WS-time-sec             PIC 9(02)  VALUE ZEROES.
003814 01  Pr-Sub-Title                Pic x(40)  Value spaces.
003815
003816 PROCEDURE       DIVISION.
003817 
003818 BEGIN-PROGRAM.
003819     Move Zero                    to "Value" OF ctNEditReadCnt.
003820     Move Zero                    to "Value" OF ctNEditWriteCnt.
003821     Move Zero                    to "Value" OF ctNEditErrorCnt.
003822     Move Zero                    to "Value" of ctNEditConvCnt.
003823     move zero                    to Conv-Error-Cnt.
003824     
003825 
003826     Move Pow-False to "Enabled" OF ctPushConvert.
003827     INVOKE ctGridResults "ClearItems" RETURNING ReturnValue.
003828     Move SPACES to Grid-Comment.
003829     String "Data Directory = "   Delimited by size
003830             Profits-Data-Loc      delimited by size
003831             into Grid-Comment.
003832             
003833     perform Add-Grid-Line.
003834
003835*     Call "ProcCheckCntlF".
003836*     Call "ProcCheckCrCdFile".
003837          
003838     IF "Value" OF CmCheckItemFile = POW-TRISTATE-CHECKED
003839        CALL "ProcConvertItemF".
003840
003841     IF "Value" OF CmCheckChrtFile = POW-TRISTATE-CHECKED
003842        CALL "ProcConvertChrtF".
003843        
003844     IF "Value" OF CmCheckPoHdFile = POW-TRISTATE-CHECKED
003845        CALL "ProcConvertPOHDF".
003846
003847     IF "Value" OF CmCheckItrnFile = POW-TRISTATE-CHECKED
003848        CALL "ProcConvertItrnF".
003849
003850     IF "Value" OF CmCheckOrdlFile = POW-TRISTATE-CHECKED
003851        CALL "ProcConvertOrdlF".
003852
003853     IF "Value" OF CmCheckStylFile = POW-TRISTATE-CHECKED
003854        CALL "ProcConvertStylF".
003855
003856     IF "Value" OF CmCheckMUCTFile = POW-TRISTATE-CHECKED
003857        CALL "ProcConvertMUCTF".
003858
003859 DONE.
003860     IF Conv-Error-Cnt > zero
003861        Set Errors-Found-Yes to True.
003862        
003863     IF ERRORS-FOUND-YES
003864        MOVE "Conversions Completed with Errors" to Grid-Comment
003865        Perform ErrorMsgBox
003866     else
003867        Move "Conversions Completed" to Grid-Comment.
003868     Move Grid-Comment to "Caption" OF ctTextCurrStatus.
003869     move zero to Grid-Index.
003870     INVOKE ctGridResults "InsertItem" USING Grid-Comment Grid-Index RETURNING ReturnValue.
003871     IF ERRORS-FOUND-YES
003872        Move Pow-Color-Red to "ItemBackColor"(grid-index) OF ctGridResults.
003873
003874
003875
003876     Move Pow-False   to     "Value" OF CmCheckItemFile
003877                             "Value" OF CmCheckChrtFile
003878                             "Value" of CmCheckPoHdFile
003879                             "Value" OF CmCheckItrnFile
003880                             .
003881
003882 END-PROGRAM.
003883     EXIT PROGRAM.  
003884     
003885 ADD-GRID-LINE.
003886     move zero to Grid-Index
003887     INVOKE ctGridResults "AddItem" USING Grid-Comment RETURNING Grid-Index.
003888
003889 ErrorMsgBox.
003890     MOVE ZERO   TO WS-MSG-STYLE.
003891     ADD  POW-DMOK TO WS-MSG-STYLE
003892     ADD  POW-DMICONWARNING TO WS-MSG-STYLE.
003893     INVOKE Pow-Self "DisplayMessage"
003894            USING Ws-Errors-Found-mSG
003895                  "Profits Warning"
003896                  WS-MSG-STYLE
003897            RETURNING ReturnValue.
003898*</SCRIPT>
003899 END PROGRAM     POW-SCRIPTLET1.
003900 IDENTIFICATION  DIVISION.
003901* ProfitsConversion-PowerBroadcast.
003902 PROGRAM-ID.     POW-SCRIPTLET2.
003903*<SCRIPT DIVISION="PROCEDURE", CONTROL="ProfitsConversion", EVENT="PowerBroadcast", POW-NAME="SCRIPTLET2", TYPE="FORM">
003904 ENVIRONMENT     DIVISION.
003905 DATA            DIVISION.
003906 WORKING-STORAGE SECTION.
003907 LINKAGE         SECTION.
003908 01  POW-ARG-EVENT   PIC S9(4) COMP-5.
003909 01  POW-ARG-DATA    PIC S9(9) COMP-5.
003910 01  POW-ARG-GRANT   PIC S9(4) COMP-5.
003911 PROCEDURE       DIVISION USING POW-ARG-EVENT POW-ARG-DATA POW-ARG-GRANT.
003912     
003913*</SCRIPT>
003914 END PROGRAM     POW-SCRIPTLET2.
003915 IDENTIFICATION  DIVISION.
003916* ProfitsConversion-Opened.
003917 PROGRAM-ID.     POW-SCRIPTLET3.
003918*<SCRIPT DIVISION="PROCEDURE", CONTROL="ProfitsConversion", EVENT="Opened", POW-NAME="SCRIPTLET3", TYPE="FORM">
003919 ENVIRONMENT     DIVISION.
003920 DATA            DIVISION.
003921 WORKING-STORAGE SECTION.
003922 PROCEDURE       DIVISION.
003923 BEGIN-PROGRAM.
003924     Call "ProcInitControls".
003925     Call "ProcInitializeVariables".
003926        
003927**     Call "ProcEnableAutoCloseTimer".
003928     Call "ProcBeginLogic".
003929     iF IOSTATUS OF ERROR-DBIO NOT = FOUND
003930        GO TO END-PROGRAM.
003931 END-PROGRAM.     
003932     EXIT PROGRAM.
003933*</SCRIPT>
003934 END PROGRAM     POW-SCRIPTLET3.
003935 IDENTIFICATION  DIVISION.
003936* CmCheckOrdLFile-LostFocus.
003937 PROGRAM-ID.     POW-SCRIPTLET4.
003938*<SCRIPT DIVISION="PROCEDURE", CONTROL="CmCheckOrdLFile", EVENT="LostFocus", POW-NAME="SCRIPTLET4", TYPE="ETC">
003939 ENVIRONMENT     DIVISION.
003940 DATA            DIVISION.
003941 WORKING-STORAGE SECTION.
003942 PROCEDURE       DIVISION.
003943     MOVE POW-FALSE TO "Highlight" OF CmCheckOrdLFile.          
003944*</SCRIPT>
003945 END PROGRAM     POW-SCRIPTLET4.
003946 IDENTIFICATION  DIVISION.
003947* CmCheckOrdLFile-GotFocus.
003948 PROGRAM-ID.     POW-SCRIPTLET5.
003949*<SCRIPT DIVISION="PROCEDURE", CONTROL="CmCheckOrdLFile", EVENT="GotFocus", POW-NAME="SCRIPTLET5", TYPE="ETC">
003950 ENVIRONMENT     DIVISION.
003951 DATA            DIVISION.
003952 WORKING-STORAGE SECTION.
003953 PROCEDURE       DIVISION.
003954     MOVE POW-TRUE TO "Highlight" OF CmCheckOrdLFile.     
003955*</SCRIPT>
003956 END PROGRAM     POW-SCRIPTLET5.
003957 IDENTIFICATION  DIVISION.
003958* CmCheckOrdLFile-Click.
003959 PROGRAM-ID.     POW-SCRIPTLET6.
003960*<SCRIPT DIVISION="PROCEDURE", CONTROL="CmCheckOrdLFile", EVENT="Click", POW-NAME="SCRIPTLET6", TYPE="ETC">
003961 ENVIRONMENT     DIVISION.
003962 DATA            DIVISION.
003963 WORKING-STORAGE SECTION.
003964 PROCEDURE       DIVISION.
003965 BEGIN-PROGRAM.
003966     CALL "ProcSetButtonConvert".
003967 
003968 END-PROGRAM.
003969     EXIT PROGRAM.
003970       
003971*</SCRIPT>
003972 END PROGRAM     POW-SCRIPTLET6.
003973 IDENTIFICATION  DIVISION.
003974* CmCheckStylFile-LostFocus.
003975 PROGRAM-ID.     POW-SCRIPTLET7.
003976*<SCRIPT DIVISION="PROCEDURE", CONTROL="CmCheckStylFile", EVENT="LostFocus", POW-NAME="SCRIPTLET7", TYPE="ETC">
003977 ENVIRONMENT     DIVISION.
003978 DATA            DIVISION.
003979 WORKING-STORAGE SECTION.
003980 PROCEDURE       DIVISION.
003981     MOVE POW-FALSE TO "Highlight" OF CmCheckStylFile.               
003982*</SCRIPT>
003983 END PROGRAM     POW-SCRIPTLET7.
003984 IDENTIFICATION  DIVISION.
003985* CmCheckStylFile-GotFocus.
003986 PROGRAM-ID.     POW-SCRIPTLET8.
003987*<SCRIPT DIVISION="PROCEDURE", CONTROL="CmCheckStylFile", EVENT="GotFocus", POW-NAME="SCRIPTLET8", TYPE="ETC">
003988 ENVIRONMENT     DIVISION.
003989 DATA            DIVISION.
003990 WORKING-STORAGE SECTION.
003991 PROCEDURE       DIVISION.
003992     MOVE POW-TRUE TO "Highlight" OF CmCheckStylFile.          
003993*</SCRIPT>
003994 END PROGRAM     POW-SCRIPTLET8.
003995 IDENTIFICATION  DIVISION.
003996* CmCheckStylFile-Click.
003997 PROGRAM-ID.     POW-SCRIPTLET9.
003998*<SCRIPT DIVISION="PROCEDURE", CONTROL="CmCheckStylFile", EVENT="Click", POW-NAME="SCRIPTLET9", TYPE="ETC">
003999 ENVIRONMENT     DIVISION.
004000 DATA            DIVISION.
004001 WORKING-STORAGE SECTION.
004002 PROCEDURE       DIVISION.
004003 BEGIN-PROGRAM.
004004     CALL "ProcSetButtonConvert".
004005 
004006 END-PROGRAM.
004007     EXIT PROGRAM.
004008      
004009*</SCRIPT>
004010 END PROGRAM     POW-SCRIPTLET9.
004011 IDENTIFICATION  DIVISION.
004012* CmCheckMUCTFile-LostFocus.
004013 PROGRAM-ID.     POW-SCRIPTLET10.
004014*<SCRIPT DIVISION="PROCEDURE", CONTROL="CmCheckMUCTFile", EVENT="LostFocus", POW-NAME="SCRIPTLET10", TYPE="ETC">
004015 ENVIRONMENT     DIVISION.
004016 DATA            DIVISION.
004017 WORKING-STORAGE SECTION.
004018 PROCEDURE       DIVISION.
004019     MOVE POW-FALSE TO "Highlight" OF CmCheckMUCTFile.               
004020*</SCRIPT>
004021 END PROGRAM     POW-SCRIPTLET10.
004022 IDENTIFICATION  DIVISION.
004023* CmCheckMUCTFile-GotFocus.
004024 PROGRAM-ID.     POW-SCRIPTLET11.
004025*<SCRIPT DIVISION="PROCEDURE", CONTROL="CmCheckMUCTFile", EVENT="GotFocus", POW-NAME="SCRIPTLET11", TYPE="ETC">
004026 ENVIRONMENT     DIVISION.
004027 DATA            DIVISION.
004028 WORKING-STORAGE SECTION.
004029 PROCEDURE       DIVISION.
004030     MOVE POW-TRUE TO "Highlight" OF CmCheckMUCTFile.          
004031*</SCRIPT>
004032 END PROGRAM     POW-SCRIPTLET11.
004033 IDENTIFICATION  DIVISION.
004034* CmCheckMUCTFile-Click.
004035 PROGRAM-ID.     POW-SCRIPTLET12.
004036*<SCRIPT DIVISION="PROCEDURE", CONTROL="CmCheckMUCTFile", EVENT="Click", POW-NAME="SCRIPTLET12", TYPE="ETC">
004037 ENVIRONMENT     DIVISION.
004038 DATA            DIVISION.
004039 WORKING-STORAGE SECTION.
004040 PROCEDURE       DIVISION.
004041 BEGIN-PROGRAM.
004042     CALL "ProcSetButtonConvert".
004043 
004044 END-PROGRAM.
004045     EXIT PROGRAM.
004046      
004047*</SCRIPT>
004048 END PROGRAM     POW-SCRIPTLET12.
004049 IDENTIFICATION  DIVISION.
004050* CmCheckItrnFile-LostFocus.
004051 PROGRAM-ID.     POW-SCRIPTLET13.
004052*<SCRIPT DIVISION="PROCEDURE", CONTROL="CmCheckItrnFile", EVENT="LostFocus", POW-NAME="SCRIPTLET13", TYPE="ETC">
004053 ENVIRONMENT     DIVISION.
004054 DATA            DIVISION.
004055 WORKING-STORAGE SECTION.
004056 PROCEDURE       DIVISION.
004057     MOVE POW-FALSE TO "Highlight" OF CmCheckItrnFile.          
004058*</SCRIPT>
004059 END PROGRAM     POW-SCRIPTLET13.
004060 IDENTIFICATION  DIVISION.
004061* CmCheckItrnFile-GotFocus.
004062 PROGRAM-ID.     POW-SCRIPTLET14.
004063*<SCRIPT DIVISION="PROCEDURE", CONTROL="CmCheckItrnFile", EVENT="GotFocus", POW-NAME="SCRIPTLET14", TYPE="ETC">
004064 ENVIRONMENT     DIVISION.
004065 DATA            DIVISION.
004066 WORKING-STORAGE SECTION.
004067 PROCEDURE       DIVISION.
004068     MOVE POW-TRUE TO "Highlight" OF CmCheckItrnFile.     
004069*</SCRIPT>
004070 END PROGRAM     POW-SCRIPTLET14.
004071 IDENTIFICATION  DIVISION.
004072* CmCheckItrnFile-Click.
004073 PROGRAM-ID.     POW-SCRIPTLET15.
004074*<SCRIPT DIVISION="PROCEDURE", CONTROL="CmCheckItrnFile", EVENT="Click", POW-NAME="SCRIPTLET15", TYPE="ETC">
004075 ENVIRONMENT     DIVISION.
004076 DATA            DIVISION.
004077 WORKING-STORAGE SECTION.
004078 PROCEDURE       DIVISION.
004079 BEGIN-PROGRAM.
004080     CALL "ProcSetButtonConvert".
004081 
004082 END-PROGRAM.
004083     EXIT PROGRAM.
004084      
004085*</SCRIPT>
004086 END PROGRAM     POW-SCRIPTLET15.
004087 IDENTIFICATION  DIVISION.
004088* CmCheckPoHdFile-LostFocus.
004089 PROGRAM-ID.     POW-SCRIPTLET16.
004090*<SCRIPT DIVISION="PROCEDURE", CONTROL="CmCheckPoHdFile", EVENT="LostFocus", POW-NAME="SCRIPTLET16", TYPE="ETC">
004091 ENVIRONMENT     DIVISION.
004092 DATA            DIVISION.
004093 WORKING-STORAGE SECTION.
004094 PROCEDURE       DIVISION.
004095     MOVE POW-FALSE TO "Highlight" OF CmCheckpohdFile.          
004096*</SCRIPT>
004097 END PROGRAM     POW-SCRIPTLET16.
004098 IDENTIFICATION  DIVISION.
004099* CmCheckPoHdFile-GotFocus.
004100 PROGRAM-ID.     POW-SCRIPTLET17.
004101*<SCRIPT DIVISION="PROCEDURE", CONTROL="CmCheckPoHdFile", EVENT="GotFocus", POW-NAME="SCRIPTLET17", TYPE="ETC">
004102 ENVIRONMENT     DIVISION.
004103 DATA            DIVISION.
004104 WORKING-STORAGE SECTION.
004105 PROCEDURE       DIVISION.
004106     MOVE POW-TRUE TO "Highlight" OF CmCheckpohdFile.     
004107*</SCRIPT>
004108 END PROGRAM     POW-SCRIPTLET17.
004109 IDENTIFICATION  DIVISION.
004110* CmCheckPoHdFile-Click.
004111 PROGRAM-ID.     POW-SCRIPTLET18.
004112*<SCRIPT DIVISION="PROCEDURE", CONTROL="CmCheckPoHdFile", EVENT="Click", POW-NAME="SCRIPTLET18", TYPE="ETC">
004113 ENVIRONMENT     DIVISION.
004114 DATA            DIVISION.
004115 WORKING-STORAGE SECTION.
004116 PROCEDURE       DIVISION.
004117 BEGIN-PROGRAM.
004118     CALL "ProcSetButtonConvert".
004119 
004120 END-PROGRAM.
004121     EXIT PROGRAM.
004122      
004123*</SCRIPT>
004124 END PROGRAM     POW-SCRIPTLET18.
004125 IDENTIFICATION  DIVISION.
004126* CmCheckSaveOrg-LostFocus.
004127 PROGRAM-ID.     POW-SCRIPTLET19.
004128*<SCRIPT DIVISION="PROCEDURE", CONTROL="CmCheckSaveOrg", EVENT="LostFocus", POW-NAME="SCRIPTLET19", TYPE="ETC">
004129 ENVIRONMENT     DIVISION.
004130 DATA            DIVISION.
004131 WORKING-STORAGE SECTION.
004132 PROCEDURE       DIVISION.
004133     MOVE POW-FALSE TO "Highlight" OF CmCheckSaveOrg.     
004134*</SCRIPT>
004135 END PROGRAM     POW-SCRIPTLET19.
004136 IDENTIFICATION  DIVISION.
004137* CmCheckSaveOrg-GotFocus.
004138 PROGRAM-ID.     POW-SCRIPTLET20.
004139*<SCRIPT DIVISION="PROCEDURE", CONTROL="CmCheckSaveOrg", EVENT="GotFocus", POW-NAME="SCRIPTLET20", TYPE="ETC">
004140 ENVIRONMENT     DIVISION.
004141 DATA            DIVISION.
004142 WORKING-STORAGE SECTION.
004143 PROCEDURE       DIVISION.
004144     MOVE POW-TRUE TO "Highlight" OF CmCheckSaveOrg.
004145*</SCRIPT>
004146 END PROGRAM     POW-SCRIPTLET20.
004147 IDENTIFICATION  DIVISION.
004148* CmCheckChrtFile-LostFocus.
004149 PROGRAM-ID.     POW-SCRIPTLET21.
004150*<SCRIPT DIVISION="PROCEDURE", CONTROL="CmCheckChrtFile", EVENT="LostFocus", POW-NAME="SCRIPTLET21", TYPE="ETC">
004151 ENVIRONMENT     DIVISION.
004152 DATA            DIVISION.
004153 WORKING-STORAGE SECTION.
004154 PROCEDURE       DIVISION.
004155     MOVE POW-FALSE TO "Highlight" OF CmCheckChrtFile
004156*</SCRIPT>
004157 END PROGRAM     POW-SCRIPTLET21.
004158 IDENTIFICATION  DIVISION.
004159* CmCheckChrtFile-GotFocus.
004160 PROGRAM-ID.     POW-SCRIPTLET22.
004161*<SCRIPT DIVISION="PROCEDURE", CONTROL="CmCheckChrtFile", EVENT="GotFocus", POW-NAME="SCRIPTLET22", TYPE="ETC">
004162 ENVIRONMENT     DIVISION.
004163 DATA            DIVISION.
004164 WORKING-STORAGE SECTION.
004165 PROCEDURE       DIVISION.
004166     MOVE POW-TRUE TO "Highlight" OF CmCheckChrtFile.
004167*</SCRIPT>
004168 END PROGRAM     POW-SCRIPTLET22.
004169 IDENTIFICATION  DIVISION.
004170* CmCheckItemFile-LostFocus.
004171 PROGRAM-ID.     POW-SCRIPTLET23.
004172*<SCRIPT DIVISION="PROCEDURE", CONTROL="CmCheckItemFile", EVENT="LostFocus", POW-NAME="SCRIPTLET23", TYPE="ETC">
004173 ENVIRONMENT     DIVISION.
004174 DATA            DIVISION.
004175 WORKING-STORAGE SECTION.
004176 PROCEDURE       DIVISION.
004177     MOVE POW-FALSE TO "Highlight" OF CmCheckItemFile
004178*</SCRIPT>
004179 END PROGRAM     POW-SCRIPTLET23.
004180 IDENTIFICATION  DIVISION.
004181* CmCheckItemFile-GotFocus.
004182 PROGRAM-ID.     POW-SCRIPTLET24.
004183*<SCRIPT DIVISION="PROCEDURE", CONTROL="CmCheckItemFile", EVENT="GotFocus", POW-NAME="SCRIPTLET24", TYPE="ETC">
004184 ENVIRONMENT     DIVISION.
004185 DATA            DIVISION.
004186 WORKING-STORAGE SECTION.
004187 PROCEDURE       DIVISION.
004188     MOVE POW-TRUE TO "Highlight" OF CmCheckItemFile
004189*</SCRIPT>
004190 END PROGRAM     POW-SCRIPTLET24.
004191 IDENTIFICATION  DIVISION.
004192* ctFrame1-Click.
004193 PROGRAM-ID.     POW-SCRIPTLET25.
004194*<SCRIPT DIVISION="PROCEDURE", CONTROL="ctFrame1", EVENT="Click", POW-NAME="SCRIPTLET25", TYPE="ETC">
004195 ENVIRONMENT     DIVISION.
004196 DATA            DIVISION.
004197 WORKING-STORAGE SECTION.
004198 PROCEDURE       DIVISION.
004199       INVOKE POW-SELF "Refresh".
004200*</SCRIPT>
004201 END PROGRAM     POW-SCRIPTLET25.
004202 IDENTIFICATION  DIVISION.
004203* CmCheckChrtFile-Click.
004204 PROGRAM-ID.     POW-SCRIPTLET26.
004205*<SCRIPT DIVISION="PROCEDURE", CONTROL="CmCheckChrtFile", EVENT="Click", POW-NAME="SCRIPTLET26", TYPE="ETC">
004206 ENVIRONMENT     DIVISION.
004207 DATA            DIVISION.
004208 WORKING-STORAGE SECTION.
004209 PROCEDURE       DIVISION.
004210 BEGIN-PROGRAM.
004211     CALL "ProcSetButtonConvert".
004212 
004213 END-PROGRAM.
004214     EXIT PROGRAM.
004215       
004216*</SCRIPT>
004217 END PROGRAM     POW-SCRIPTLET26.
004218 IDENTIFICATION  DIVISION.
004219* ctComboCompanyFolder-Change.
004220 PROGRAM-ID.     POW-SCRIPTLET27.
004221*<SCRIPT DIVISION="PROCEDURE", CONTROL="ctComboCompanyFolder", EVENT="Change", POW-NAME="SCRIPTLET27", TYPE="ETC">
004222 ENVIRONMENT     DIVISION.
004223 DATA            DIVISION.
004224 WORKING-STORAGE SECTION.
004225 01   WS-COMPANY-NAME       PIC X(40).
004226 LINKAGE         SECTION.
004227 01  POW-ARG-NLISTINDEX PIC S9(4) COMP-5.
004228 PROCEDURE       DIVISION USING POW-ARG-NLISTINDEX.
004229 DECLARATIVES.
004230     COPY "CNTLF.DS".
004231     GO TO STATUS-EXIT.
004232        
004233 STATUS-CHECK.
004234           IF FILE-STATUS = RECORD-LOCK OR DUPLICATE-RECORD
004235              GO TO STATUS-EXIT.
004236
004237           SET DBIO OF ERROR-KIND TO TRUE.
004238           MOVE FILE-NAME        TO ERROR-DBIO.
004239           MOVE FILE-STATUS      TO IOSTATUS OF ERROR-DBIO.
004240           MOVE "45CONVERT.EXE"    TO ERROR-PROGRNAME.
004241           INVOKE POW-SELF "CallForm" USING "DBIOERROR" "ERRORBOX"
004242                 RETURNING ReturnValue.
004243           INVOKE POW-SELF "CloseForm" USING "ProfitsConversion"
004244                 RETURNING ReturnValue.
004245           EXIT PROGRAM.
004246           
004247 STATUS-EXIT. EXIT.       
004248 END DECLARATIVES. 
004249 BEGIN-PROGRAM.
004250     MOVE "ListText"(POW-ARG-NLISTIndex) OF ctComboCompanyFolder to TextF-REc.
004251     UNSTRING TEXTF-REC DELIMITED BY "~"
004252           INTO WS-COMPANY-NAME
004253                 Profits-Data-Loc.
004254
004255     CALL "ProcOpenFiles".
004256*     OPEN INPUT CNTLF.
004257     Call "ProcReadCntlFile".
004258     Close CNTLF.
004259     Call "ProcLoadScrnHeaderInfo".
004260                     
004261 END-PROGRAM.
004262
004263
004264
004265
004266       
004267*</SCRIPT>
004268 END PROGRAM     POW-SCRIPTLET27.
004269 IDENTIFICATION  DIVISION.
004270* ctPushSelectAll-Click.
004271 PROGRAM-ID.     POW-SCRIPTLET28.
004272*<SCRIPT DIVISION="PROCEDURE", CONTROL="ctPushSelectAll", EVENT="Click", POW-NAME="SCRIPTLET28", TYPE="ETC">
004273 ENVIRONMENT     DIVISION.
004274 DATA            DIVISION.
004275 WORKING-STORAGE SECTION.
004276 PROCEDURE       DIVISION.
004277 BEGIN-PROGRAM.
004278     MOVE POW-TRUE TO "Enabled" OF ctPushConvert.
004279     Move Pow-Tristate-checked to "Value" OF CmCheckItemFile
004280                                  "Value" OF CmCheckChrtFile
004281                                  "Value" OF CmCheckPoHdFile
004282                                  "Value" OF CmCheckItrnFile
004283                                  "Value" OF CmCheckOrdlFile
004284                                  "Value" OF CmCheckStylFile
004285                                  .
004286
004287 END-PROGRAM.
004288     EXIT PROGRAM.
004289      
004290*</SCRIPT>
004291 END PROGRAM     POW-SCRIPTLET28.
004292 IDENTIFICATION  DIVISION.
004293* ctPushDeSelectAll-Click.
004294 PROGRAM-ID.     POW-SCRIPTLET29.
004295*<SCRIPT DIVISION="PROCEDURE", CONTROL="ctPushDeSelectAll", EVENT="Click", POW-NAME="SCRIPTLET29", TYPE="ETC">
004296 ENVIRONMENT     DIVISION.
004297 DATA            DIVISION.
004298 WORKING-STORAGE SECTION.
004299 PROCEDURE       DIVISION.
004300 BEGIN-PROGRAM.
004301     MOVE POW-FALSE TO "Enabled" OF ctPushConvert.
004302     Move Pow-Tristate-Unchecked to "Value" OF CmCheckItemFile
004303                                    "Value" OF CmCheckChrtFile
004304                                    "Value" OF CmCheckPoHdFile
004305                                    "Value" OF CmCheckItrnFile
004306                                    "Value" OF CmCheckOrdlFile
004307                                    "Value" OF CmCheckStylFile
004308                                    .
004309
004310     
004311 END-PROGRAM.
004312     EXIT PROGRAM.
004313         
004314*</SCRIPT>
004315 END PROGRAM     POW-SCRIPTLET29.
004316 IDENTIFICATION  DIVISION.
004317* CmCheckItemFile-Click.
004318 PROGRAM-ID.     POW-SCRIPTLET30.
004319*<SCRIPT DIVISION="PROCEDURE", CONTROL="CmCheckItemFile", EVENT="Click", POW-NAME="SCRIPTLET30", TYPE="ETC">
004320 ENVIRONMENT     DIVISION.
004321 DATA            DIVISION.
004322 WORKING-STORAGE SECTION.
004323 PROCEDURE       DIVISION.
004324 BEGIN-PROGRAM.
004325     CALL "ProcSetButtonConvert".
004326 
004327 END-PROGRAM.
004328     EXIT PROGRAM.
004329        
004330*</SCRIPT>
004331 END PROGRAM     POW-SCRIPTLET30.
004332 IDENTIFICATION  DIVISION.
004333* ctPushExit-Click.
004334 PROGRAM-ID.     POW-SCRIPTLET31.
004335*<SCRIPT DIVISION="PROCEDURE", CONTROL="ctPushExit", EVENT="Click", POW-NAME="SCRIPTLET31", TYPE="ETC">
004336 ENVIRONMENT     DIVISION.
004337 DATA            DIVISION.
004338 WORKING-STORAGE SECTION.
004339 PROCEDURE       DIVISION.
004340 BEGIN-PROGRAM.
004341     INVOKE POW-SELF "CloseForm" .
004342 END-PROGRAM.
004343     EXIT PROGRAM.    
004344*</SCRIPT>
004345 END PROGRAM     POW-SCRIPTLET31.
004346 IDENTIFICATION  DIVISION.
004347* ctClockAutoClose-Alarm.
004348 PROGRAM-ID.     POW-SCRIPTLET32.
004349*<SCRIPT DIVISION="PROCEDURE", CONTROL="ctClockAutoClose", EVENT="Alarm", POW-NAME="SCRIPTLET32", TYPE="ETC">
004350 ENVIRONMENT     DIVISION.
004351 DATA            DIVISION.
004352 WORKING-STORAGE SECTION.
004353 LINKAGE         SECTION.
004354 01  POW-ARG-NHOUR   PIC S9(4) COMP-5.
004355 01  POW-ARG-NMINUTE PIC S9(4) COMP-5.
004356 01  POW-ARG-NSECOND PIC S9(4) COMP-5.
004357 PROCEDURE       DIVISION USING POW-ARG-NHOUR POW-ARG-NMINUTE POW-ARG-NSECOND.
004358     Move Pow-False to "Enabled" OF ctClockAutoClose.
004359     INVOKE pow-self "CallForm" USING "FormAutoClose" RETURNING Form-Return-Code.
004360*     If ReturnValue = 301 or 201
004361*        INVOKE pow-self "CloseForm"
004362*     Else
004363*        Call "ProcEnableAutoCloseTimer".
004364*      if Form-Return-Code = Time-Out 
004365*         move "no button selected" to "Caption" OF CmStatic1
004366*      else
004367*      if Form-Return-Code = Return-Button
004368*         move "return button selected" to "Caption" OF CmStatic1
004369*      else
004370*      if Form-Return-Code = Exit-Button
004371*         move "Exit button selected" to "Caption" OF CmStatic1.
004372             
004373     
004374*</SCRIPT>
004375 END PROGRAM     POW-SCRIPTLET32.
004376 END PROGRAM     ProfitsConversion.
