home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Sams Cobol 24 Hours
/
Sams_Cobol_24_Hours.iso
/
Cobol32
/
PowerCBL
/
powercbl.Z
/
loadfile.prc
< prev
next >
Wrap
Text File
|
1997-03-14
|
7KB
|
264 lines
@POWER POWSHEET LSFILE WORKING
01 EX-VALUE GLOBAL EXTERNAL.
02 EX-INITFILE PIC X(128).
@POWER POWSHEET LSFILE CONSTANT
01 CT-VALUE GLOBAL.
02 CT-TAB PIC X VALUE X"09".
02 CT-SEC-NON PIC 9 VALUE 0.
02 CT-SEC-OPTION PIC 9 VALUE 1.
02 CT-OPTION1 PIC 9 VALUE 0.
02 CT-OPTION2 PIC 9 VALUE 1.
02 CT-OPTION3 PIC 9 VALUE 2.
02 CT-CHECK-OFF PIC 9 VALUE 0.
02 CT-CHECK-ON PIC 9 VALUE 1.
@POWER POWSHEET LSFILE PROCEDURE
*
* open file
*
IDENTIFICATION DIVISION.
PROGRAM-ID. "INIT-OPEN" COMMON.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 WK-IDX PIC S9(4) COMP-5.
01 WK-CNT PIC S9(4) COMP-5.
01 WK-STRING.
02 WK-ONECHAR PIC X.
02 FILLER PIC X(63).
01 WK-SECTION PIC 9.
01 WK-SELNAME PIC X(32).
01 WK-FLAG PIC 9.
01 WK-OPTION PIC 9.
01 WK-CHECK1 PIC 9 VALUE 1.
01 WK-CHECK2 PIC 9 VALUE 0.
01 WK-CHECK3 PIC 9 VALUE 0.
PROCEDURE DIVISION.
*
* Option1 = OFF Check1=ON
* Option1 = ON Check1=OFF
* Option1 = OFF Check1=OFF
*
MOVE CT-SEC-NON TO WK-SECTION.
MOVE CT-OPTION2 TO WK-OPTION.
MOVE CT-CHECK-ON TO WK-CHECK1.
MOVE CT-CHECK-OFF TO WK-CHECK2.
MOVE CT-CHECK-OFF TO WK-CHECK3.
*
* Set initial values.
*
CALL LOADFILE OF LB-OPEN USING EX-INITFILE.
MOVE 0 TO WK-IDX.
MOVE POW-COUNT OF LB-OPEN TO WK-CNT.
PERFORM GETPROFILE VARYING WK-IDX FROM 1 BY 1
UNTIL WK-IDX > WK-CNT
EVALUATE WK-OPTION
WHEN 1
MOVE POW-ON TO POW-CHECK OF RB-OPTION2
WHEN 2
MOVE POW-ON TO POW-CHECK OF RB-OPTION3
WHEN OTHER
MOVE POW-ON TO POW-CHECK OF RB-OPTION1
END-EVALUATE.
IF WK-CHECK1 = 0 THEN
MOVE POW-OFF TO POW-CHECK OF MN-CHECK1
MOVE POW-OFF TO POW-CHECK OF CB-CHECK1
ELSE
MOVE POW-ON TO POW-CHECK OF MN-CHECK1
MOVE POW-ON TO POW-CHECK OF CB-CHECK1
END-IF.
IF WK-CHECK2 = 0 THEN
MOVE POW-OFF TO POW-CHECK OF MN-CHECK2
MOVE POW-OFF TO POW-CHECK OF CB-CHECK2
ELSE
MOVE POW-ON TO POW-CHECK OF MN-CHECK2
MOVE POW-ON TO POW-CHECK OF CB-CHECK2
END-IF.
IF WK-CHECK3 = 0 THEN
MOVE POW-OFF TO POW-CHECK OF MN-CHECK3
MOVE POW-OFF TO POW-CHECK OF CB-CHECK3
ELSE
MOVE POW-ON TO POW-CHECK OF MN-CHECK3
MOVE POW-ON TO POW-CHECK OF CB-CHECK3
END-IF.
MAIN-END.
EXIT PROGRAM.
******************************************************************
GETPROFILE SECTION.
******************************************************************
MOVE POW-STRING (WK-IDX) OF LB-OPEN TO WK-STRING.
*
* comment ";"
*
IF WK-ONECHAR = ";" THEN GO TO EXIT-GETPROFILE.
*
* section
*
IF WK-ONECHAR = "[" THEN
IF WK-STRING = "[OPTION]" THEN
MOVE CT-SEC-OPTION TO WK-SECTION
ELSE
MOVE CT-SEC-NON TO WK-SECTION
END-IF
GO TO EXIT-GETPROFILE
END-IF.
*
* entry
*
IF WK-SECTION = CT-SEC-OPTION THEN
UNSTRING WK-STRING
DELIMITED BY ALL SPACE OR ALL CT-TAB OR "="
INTO WK-SELNAME WK-FLAG
EVALUATE WK-SELNAME
WHEN "OPTION"
MOVE WK-FLAG TO WK-OPTION
WHEN "CHECK1"
MOVE WK-FLAG TO WK-CHECK1
WHEN "CHECK2"
MOVE WK-FLAG TO WK-CHECK2
WHEN "CHECK3"
MOVE WK-FLAG TO WK-CHECK3
END-EVALUATE
END-IF.
*
EXIT-GETPROFILE.
*
EXIT.
END PROGRAM "INIT-OPEN".
@POWER POWSHEET LSFILE OPENED
ENVIRONMENT DIVISION.
DATA DIVISION.
PROCEDURE DIVISION.
MOVE "INITFILE.INI" TO EX-INITFILE.
CALL "INIT-OPEN".
@POWER POWSHEET LSFILE CLOSECHILD
ENVIRONMENT DIVISION.
DATA DIVISION.
PROCEDURE DIVISION.
MOVE POW-ON TO POW-ENABLE OF LSFILE.
@POWER POWCKBTN CB-CHECK1 CLICK
ENVIRONMENT DIVISION.
DATA DIVISION.
PROCEDURE DIVISION.
IF POW-CHECK OF CB-CHECK1 = POW-ON THEN
MOVE POW-ON TO POW-CHECK OF MN-CHECK1
ELSE
MOVE POW-OFF TO POW-CHECK OF MN-CHECK1
END-IF.
@POWER POWCKBTN CB-CHECK2 CLICK
ENVIRONMENT DIVISION.
DATA DIVISION.
PROCEDURE DIVISION.
IF POW-CHECK OF CB-CHECK2 = POW-ON THEN
MOVE POW-ON TO POW-CHECK OF MN-CHECK2
ELSE
MOVE POW-OFF TO POW-CHECK OF MN-CHECK2
END-IF.
@POWER POWRDBTN RB-OPTION1 CLICK
ENVIRONMENT DIVISION.
DATA DIVISION.
PROCEDURE DIVISION.
MOVE POW-ON TO POW-CHECK OF MN-OPTION1.
MOVE POW-OFF TO POW-CHECK OF MN-OPTION2.
MOVE POW-OFF TO POW-CHECK OF MN-OPTION3.
@POWER POWRDBTN RB-OPTION2 CLICK
ENVIRONMENT DIVISION.
DATA DIVISION.
PROCEDURE DIVISION.
MOVE POW-OFF TO POW-CHECK OF MN-OPTION1.
MOVE POW-ON TO POW-CHECK OF MN-OPTION2.
MOVE POW-OFF TO POW-CHECK OF MN-OPTION3.
@POWER POWRDBTN RB-OPTION3 CLICK
ENVIRONMENT DIVISION.
DATA DIVISION.
PROCEDURE DIVISION.
MOVE POW-OFF TO POW-CHECK OF MN-OPTION1.
MOVE POW-OFF TO POW-CHECK OF MN-OPTION2.
MOVE POW-ON TO POW-CHECK OF MN-OPTION3.
@POWER POWCKBTN CB-CHECK3 CLICK
ENVIRONMENT DIVISION.
DATA DIVISION.
PROCEDURE DIVISION.
IF POW-CHECK OF CB-CHECK3 = POW-ON THEN
MOVE POW-ON TO POW-CHECK OF MN-CHECK3
ELSE
MOVE POW-OFF TO POW-CHECK OF MN-CHECK3
END-IF.
@POWER POWMENU MN-OPTION1 CLICK
ENVIRONMENT DIVISION.
DATA DIVISION.
PROCEDURE DIVISION.
MOVE POW-ON TO POW-CHECK OF RB-OPTION1.
@POWER POWMENU MN-OPTION2 CLICK
ENVIRONMENT DIVISION.
DATA DIVISION.
PROCEDURE DIVISION.
MOVE POW-ON TO POW-CHECK OF RB-OPTION2.
@POWER POWMENU MN-OPTION3 CLICK
ENVIRONMENT DIVISION.
DATA DIVISION.
PROCEDURE DIVISION.
MOVE POW-ON TO POW-CHECK OF RB-OPTION3.
@POWER POWMENU MN-CHECK1 CLICK
ENVIRONMENT DIVISION.
DATA DIVISION.
PROCEDURE DIVISION.
IF POW-OFF = POW-CHECK OF MN-CHECK1 THEN
MOVE POW-ON TO POW-CHECK OF MN-CHECK1
MOVE POW-ON TO POW-CHECK OF CB-CHECK1
ELSE
MOVE POW-OFF TO POW-CHECK OF MN-CHECK1
MOVE POW-OFF TO POW-CHECK OF CB-CHECK1
END-IF.
@POWER POWMENU MN-CHECK2 CLICK
ENVIRONMENT DIVISION.
DATA DIVISION.
PROCEDURE DIVISION.
IF POW-OFF = POW-CHECK OF MN-CHECK2 THEN
MOVE POW-ON TO POW-CHECK OF MN-CHECK2
MOVE POW-ON TO POW-CHECK OF CB-CHECK2
ELSE
MOVE POW-OFF TO POW-CHECK OF MN-CHECK2
MOVE POW-OFF TO POW-CHECK OF CB-CHECK2
END-IF.
@POWER POWMENU MN-CHECK3 CLICK
ENVIRONMENT DIVISION.
DATA DIVISION.
PROCEDURE DIVISION.
IF POW-OFF = POW-CHECK OF MN-CHECK3 THEN
MOVE POW-ON TO POW-CHECK OF MN-CHECK3
MOVE POW-ON TO POW-CHECK OF CB-CHECK3
ELSE
MOVE POW-OFF TO POW-CHECK OF MN-CHECK3
MOVE POW-OFF TO POW-CHECK OF CB-CHECK3
END-IF.
@POWER POWMENU MN-OPEN CLICK
ENVIRONMENT DIVISION.
DATA DIVISION.
PROCEDURE DIVISION.
MOVE POW-OFF TO POW-ENABLE OF LSFILE.
CALL OPENSHEET OF LSFILE USING "ST-INITFILE".
@POWER POWMENU MN-EXIT CLICK
ENVIRONMENT DIVISION.
DATA DIVISION.
PROCEDURE DIVISION.
CALL CLOSESHEET OF LSFILE.
@POWER POWPSBTN PUSH1 CLICK
ENVIRONMENT DIVISION.
DATA DIVISION.
PROCEDURE DIVISION.
* Close the sample application.
CALL CLOSESHEET OF LSFILE.