BCS 8080 Reproduction With Modifications

This example demonstrates how to use available COBOL sub programs to perform reproduction of 80 column records. This framework hands you the underpinnings clone source code.

000100 IDENTIFICATION DIVISION.
000200 PROGRAM-ID.    ABM00017.
000300 AUTHOR.        ARCH BROOKS.
000400 INSTALLATION   BROOKS COMPUTING SYSTEMS, LLC.
000500 DATE-WRITTEN.  09/30/2014.
000600 DATE-COMPILED. 09/30/2014.
000700*
000800*
000900*  THIS PROGRAM PROVIDES ALL NECESSARY COMMUNICATION TO PROCESS
001000*  ALL THE RECORDS IN THE INPUT FILE.
001100*
001200*  AFTER PROCESSING IS COMPLETE THE FILES ARE CLOSED
001300*
001400*
001500 ENVIRONMENT DIVISION.
001600 CONFIGURATION SECTION.
001700 SOURCE-COMPUTER. IBM-Z-OS.
001800 OBJECT-COMPUTER. IBM-Z-OS.
001900 INPUT-OUTPUT SECTION.
002000 FILE-CONTROL.
002100 DATA DIVISION.
002200 FILE SECTION.
002300 WORKING-STORAGE SECTION.
002400 01  EOF-SW PIC X.
002500     88  EOF VALUE 'X'.
002600 01  BUF PIC X(80).
002700 PROCEDURE DIVISION.
002800*  OPEN INPUT FILE
002900     CALL 'ABS00014' USING EOF-SW.
003000*  OPEN OUTPUT FILE
003100     CALL 'ABS00003'.
003200*  PREPARE RECORDS UNTIL ALL ARE PROCESSED
003300     PERFORM 0010-PROC-RECS UNTIL EOF.
003400*  CLOSE INPUT FILE
003500     CALL 'ABS0014B'.
003600*  CLOSE OUTPUT FILE
003700     CALL 'ABS0003B'.
003800     GOBACK.
003900*  PROCESS ALL RECORDS
004000 0010-PROC-RECS.
004100     CALL 'ABS0014A' USING BUF, EOF-SW.
004200     IF NOT EOF THEN
004300         PERFORM 0020-FIX-REC.
004400*  MODIFY RECORDS BEFORE WRITING THE TO THE OUTPUT FILE.
004500 0020-FIX-REC.
004600     CALL 'ABS0003A' USING BUF.

The following code describes the code that reads the records.

000100 IDENTIFICATION DIVISION.
000200 PROGRAM-ID.    ABS00014.
000300 AUTHOR.        ARCH BROOKS.
000400 INSTALLATION   BROOKS COMPUTING SYSTEMS, LLC.
000500 DATE-WRITTEN.  09/15/2014.
000600 DATE-COMPILED. 09/15/2014.
000700*
000800*  THIS PROGRAM IS DESIGNED TO PROVIDE ALL NECESSARY COMMMUNCATIONS
000900*  TO READ 80 BYTE RECORDS FROM THE INPUT FILE.
001000*
001100*  THE END OF FILE SWITCH IS SET WHEN THE END OF THE DATA IS REACHED.
001200*
001300 ENVIRONMENT DIVISION.
001400 INPUT-OUTPUT SECTION.
001500 FILE-CONTROL.
001600     SELECT I-FILE ASSIGN TO UT-S-FSIN
001700     ORGANIZATION IS SEQUENTIAL.
001800 DATA DIVISION.
001900 FILE SECTION.
002000 FD  I-FILE
002100     DATA RECORD IS I-RECORD
002200     BLOCK CONTAINS 0 RECORDS
002300     RECORDING MODE IS F.
002400 01  I-RECORD PIC X(80).
002500 WORKING-STORAGE SECTION.
002600 LINKAGE SECTION.
002700 01  EOF-SW PIC X.
002800     88 EOF VALUE 'X'.
002900 01  LSBUF PIC X(80).
003000 PROCEDURE DIVISION USING EOF-SW.
003100*  OPEN THE INPUT FILE
003200     MOVE ' ' TO EOF-SW.
003300     OPEN INPUT I-FILE.
003400     PERFORM 0020-RETURN.
003500*  READ THE FILE
003600     ENTRY 'ABS0014A' USING LSBUF EOF-SW.
003700     READ I-FILE
003800         AT END MOVE 'X' TO EOF-SW.
003900     IF NOT EOF THEN
004000         PERFORM 0010-FIX-RECORD.
004100     PERFORM 0020-RETURN.
004200 0010-FIX-RECORD.
004300     MOVE I-RECORD TO LSBUF.
004400 0012-STOP-FLOW.
004500*  CLOSE THE FILE
004600     ENTRY 'ABS0014B'.
004700     CLOSE I-FILE.
004800     PERFORM 0020-RETURN.
004900*  LET'S GET OUT OF HERE
005000 0020-RETURN.
005100     GOBACK.

Now the code in this section allows us to output the data.

000100 IDENTIFICATION DIVISION.
000200 PROGRAM-ID.    ABS00003.
000300 AUTHOR.        ARCH BROOKS.
000400 INSTALLATION   BROOKS COMPUTING SYSTEMS, LLC.
000500 DATE-WRITTEN.  09/15/2014.
000600 DATE-COMPILED. 09/15/2014.
000700*
000800*
000900*  THIS PROGRAM IS DESIGNED TO WRITE RECORDS TO THE FILE.
001000*
001100*
001200*
001300*
001400 ENVIRONMENT DIVISION.
001500 INPUT-OUTPUT SECTION.
001600 FILE-CONTROL.
001700     SELECT F-FILE ASSIGN TO UT-S-FSOUT
001800     ORGANIZATION IS SEQUENTIAL.
001900 DATA DIVISION.
002000 FILE SECTION.
002100 FD  F-FILE
002200     DATA RECORD IS F-RECORD
002300     BLOCK CONTAINS 0 RECORDS
002400     RECORDING MODE IS F.
002500 01  F-RECORD PIC X(80).
002600 WORKING-STORAGE SECTION.
002700 LINKAGE SECTION.
002800 01  LSBUF PIC X(80).
002900 PROCEDURE DIVISION.
003000*  OPEN THE OUTPUT FILE
003100     OPEN OUTPUT F-FILE.
003200     PERFORM 0010-RETURN.
003300*  WRITE A RECORD
003400     ENTRY 'ABS0003A' USING LSBUF.
003500     WRITE F-RECORD FROM LSBUF.
003600     PERFORM 0010-RETURN.
003700*  CLOSE THE FILE
003800     ENTRY 'ABS0003B'.
003900     CLOSE F-FILE.
004000     PERFORM 0010-RETURN.
004100*  LETS GET OUT OF HERE
004200 0010-RETURN.
004300     GOBACK.

The code below describes the command list (clist) employed to invoke the program after compiling and linking.

PROC 0
CONTROL NOLIST NOMSG
FREE FI(SYSOUT SYSPRINT FSIN FSOUT)
ALLOC FI(SYSPRINT) DA(*)
ALLOC FI(SYSOUT) DA(OUT) SHR
ALLOC FI(FSIN) DA(PDS.COBOL(ABM00016))
ALLOC FI(FSOUT) DA(TST)
CALL 'AMBMVS.PDS.LOAD(ABM00017)'
FREE FI(SYSOUT SYSPRINT FSIN FSOUT)
ISPEXEC BROWSE DATASET(TST)

These routines can be used to tailor almost any type of source code.  What I recommend is to clone a copy of this software then add the desirable functionality to generate the end result source code.

Mr. Arch Brooks, Software Engineer, Brooks Computing Systems, LLC authored this article.

Leave a Reply