Trailing-Edge
-
PDP-10 Archives
-
BB-4171G-BM
-
uetp/lib/pbload.cbl
There are 13 other files named pbload.cbl in the archive. Click here to see a list.
ID DIVISION.
PROGRAM-ID. PBLOAD.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT OUTFIL ASSIGN TO DSK
RECORDING MODE IS ASCII.
DATA DIVISION.
FILE SECTION.
FD OUTFIL
VALUE OF ID "PBLOADFIL"
DATA RECORD IS LOADREC.
01 LOADREC PIC X(80).
WORKING-STORAGE SECTION.
01 CTRX PIC 999 VALUE 000.
01 LINK-CTR PIC 9999 VALUE 0.
01 INPUT-TYPE PIC X(14) VALUE 'CUSTOMER INPUT'.
01 INPUT-STRING PIC X(40).
01 START-NUMBER PIC 9(5).
01 END-NUMBER PIC 9(5).
01 INCREMENT-NUMBER PIC 9(3).
01 DELIM-COMMA PIC X VALUE ",".
01 DELIM-SPACE PIC X VALUE SPACE.
01 WORK-REC COPY PBTRAN.
01 CTR PIC S9(5) VALUE 0.
PROCEDURE DIVISION.
START.
OPEN OUTPUT OUTFIL.
GET-INPUT.
DISPLAY INPUT-TYPE,': START NUMBER,END NUMBER,INCREMENT NUMBER'.
ACCEPT INPUT-STRING.
UNSTRING INPUT-STRING DELIMITED ALL "," OR ALL " " INTO
START-NUMBER DELIMITER DELIM-COMMA
END-NUMBER DELIMITER DELIM-COMMA
INCREMENT-NUMBER DELIMITER DELIM-SPACE.
MOVE START-NUMBER TO CTR.
CUSTOMER-LOOP.
IF END-NUMBER < CTR GO TO METER-DISPLAY.
MOVE CTR TO T-CUST.
MOVE 05 TO T-TYPE.
WRITE LOADREC FROM WORK-REC.
ADD INCREMENT-NUMBER TO CTR.
GO TO CUSTOMER-LOOP.
METER-DISPLAY.
MOVE SPACE TO WORK-REC.
MOVE 'METER INPUT' TO INPUT-TYPE.
PERFORM GET-INPUT.
METER-LOOP.
IF END-NUMBER < CTR GO TO BRANCH-DISPLAY.
MOVE CTR TO T-METER.
MOVE 07 TO T-TYPE.
WRITE LOADREC FROM WORK-REC.
ADD INCREMENT-NUMBER TO CTR.
GO TO METER-LOOP.
BRANCH-DISPLAY.
MOVE 'BRANCH INPUT' TO INPUT-TYPE.
PERFORM GET-INPUT.
MOVE SPACE TO WORK-REC.
BRANCH-LOOP.
IF END-NUMBER < CTR GO TO PARENT-DISPLAY.
MOVE CTR TO T-BRANCH.
MOVE 14 TO T-TYPE.
WRITE LOADREC FROM WORK-REC.
ADD INCREMENT-NUMBER TO CTR.
GO TO BRANCH-LOOP.
PARENT-DISPLAY.
MOVE 'PARENT INPUT' TO INPUT-TYPE.
PERFORM GET-INPUT.
MOVE SPACE TO WORK-REC.
PARENT-LOOP.
IF END-NUMBER < CTR GO TO CUSTOMER-LINK.
MOVE CTR TO T-PARENT.
MOVE 13 TO T-TYPE.
WRITE LOADREC FROM WORK-REC.
ADD INCREMENT-NUMBER TO CTR.
GO TO PARENT-LOOP.
CUSTOMER-LINK.
MOVE SPACES TO WORK-REC.
MOVE 'CUSTOMER LINKS' TO INPUT-TYPE.
PERFORM GET-INPUT.
DISPLAY 'HOW MANY CUSTOMER LINKS ?'.
ACCEPT LINK-CTR.
MOVE 1 TO CTR.
LOOP-A.
IF END-NUMBER < START-NUMBER GO TO PARENT-LINK.
MOVE '01' TO T-TYPE.
MOVE START-NUMBER TO T-CUST.
MOVE 0 TO CTRX.
LOOP-B.
ADD 1 TO CTRX.
MOVE CTR TO T-METER.
MOVE CTR TO T-BRANCH.
WRITE LOADREC FROM WORK-REC.
ADD INCREMENT-NUMBER TO CTR.
IF CTRX < LINK-CTR GO TO LOOP-B.
ADD INCREMENT-NUMBER TO START-NUMBER.
GO TO LOOP-A.
PARENT-LINK.
MOVE SPACES TO WORK-REC.
MOVE 'PARENT LINKS' TO INPUT-TYPE.
PERFORM GET-INPUT.
DISPLAY 'HOW MANY PARENT BRANCH LINKS?'.
ACCEPT LINK-CTR.
MOVE 1 TO CTR.
LOOP-C.
IF END-NUMBER < START-NUMBER GO TO END-IT.
MOVE '03' TO T-TYPE.
MOVE START-NUMBER TO T-PARENT.
MOVE 0 TO CTRX.
LOOP-D.
ADD 1 TO CTRX.
MOVE CTR TO T-BRANCH.
WRITE LOADREC FROM WORK-REC.
ADD INCREMENT-NUMBER TO CTR.
IF CTRX < LINK-CTR GO TO LOOP-D.
ADD INCREMENT-NUMBER TO START-NUMBER.
GO TO LOOP-C.
END-IT.
CLOSE OUTFIL.
STOP RUN.