COBRENUM - Renumber a MVT COBOL memmber
Function of the utility
This program will perform one of two functions depending upon the PARM value passed to it
- PARM='RENUMBER' - renumbers the sequence numbers at the start of each line (cols 1-6) required by the MVT COBOL compiler, and also renumbers the sequence numbers in cols 73-78 for good measure. The member is updated in place (actually updated in a work file and copied back, but to the user in place)
- PARM='NEW' - reads in a unsequenced MVT COBOL card deck (not numbered, all instructions
left justified starting in column 1), and will move the data on each card to the right,
insert the MVT COBOL numbering in cols 1-6 and add the card sequence numbers in cols 73-80
Obviously written to meet one of my needs. I didn't want to have to worry about sequence numbering when playing around with MVT COBOL. I just write my code all nicely left aligned in vi then let the program renumber it when it gets stored to be compiled, and for small changes I can just do them in RPF and then renumber using this program without having to bother with keeping everything in sequence while I do the editing.
Examples of use
Renumbering an existing member
//TESTNBR EXEC PGM=COBRENUM,PARM='RENUMBER' //SYSUT1 DD DISP=(NEW,PASS,DELETE), // DCB=(RECFM=F,LRECL=80,BLKSIZE=80,DSORG=PS), // UNIT=SYSDA,SPACE=(TRK,(5,5)),DSN=&&WORK //COBOL DD DISP=SHR, // DSN=MARK.LIB.SOURCE.COBOL(TESTRNUM) //
Note that the SYSIN DD card is NOT required for PARM='RENUMBER'.
The member TESTRNUM will be renumbered in place.
The SYSUT1 DD is required, it must provide a card image work file
large enough to contain the member being processed. The origional member will
only be replaced if there are no problems with renumbering it out to the work area.
Reading an unnumbered card deck from SYSIN to be stored
as a new member with sequence numbers inserted
And yes it is a long winded example, copy cards from SYSIN to SYSPRINT;
I really have trouble remembering syntax for this old compiler so if I paste
the whole thing I can refer to it too :-)
//TEST3 EXEC PGM=COBRENUM,PARM='NEW' //SYSUT1 DD DISP=(NEW,PASS,DELETE), // DCB=(RECFM=F,LRECL=80,BLKSIZE=80,DSORG=PS), // UNIT=SYSDA,SPACE=(TRK,(5,5)),DSN=&&WORK //COBOL DD DISP=SHR, // DSN=MARK.LIB.SOURCE.COBOL(TESTRNUM) //SYSIN DD * IDENTIFICATION DIVISION. PROGRAM-ID. 'COBTEST'. AUTHOR. MARK DICKINSON. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SOURCE-COMPUTER. IBM-370. OBJECT-COMPUTER. IBM-370. SPECIAL-NAMES. CONSOLE IS CNSL. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT CARDFILE ASSIGN TO UT-S-SYSIN. SELECT RPTFILE ASSIGN TO UT-S-SYSPRINT. DATA DIVISION. FILE SECTION. FD CARDFILE LABEL RECORDS ARE OMITTED BLOCK CONTAINS 0 CHARACTERS RECORD CONTAINS 80 CHARACTERS DATA RECORD IS FILEREC-CARDFILE. 01 FILEREC-CARDFILE. 02 DATA-CARD PIC X(80). FD RPTFILE LABEL RECORDS ARE OMITTED BLOCK CONTAINS 0 CHARACTERS RECORD CONTAINS 132 CHARACTERS DATA RECORD IS FILEREC-RPTFILE. 01 FILEREC-RPTFILE. 02 RPTLINE PIC X(132). WORKING-STORAGE SECTION. 77 HELLO-CONST PIC X(12) VALUE 'HELLO, WORLD'. 77 BANNER-LINE PIC X(132) VALUE 'PROGRAM INITIALISED, FILES OPEN'. PROCEDURE DIVISION. 000-BEGIN. DISPLAY HELLO-CONST UPON CNSL. PERFORM 100-INITIALIZE. MOVE BANNER-LINE TO FILEREC-RPTFILE. WRITE FILEREC-RPTFILE. MOVE HELLO-CONST TO RPTLINE. WRITE FILEREC-RPTFILE. 010-READ-NEXT. READ CARDFILE AT END GO TO 999-EXIT. MOVE DATA-CARD TO RPTLINE. WRITE FILEREC-RPTFILE. GO TO 010-READ-NEXT. 100-INITIALIZE. OPEN OUTPUT RPTFILE. OPEN INPUT CARDFILE. 999-EXIT. CLOSE RPTFILE, CARDFILE. STOP RUN. /* //
Note that the SYSIN DD card is required for PARM='NEW'.
The SYSUT1 DD is required, it must provide a card image work file
large enough to contain the cards being processed.
Program Source
On the assumption this may be useful to someone, this is the source code.
You are free to copy and customise for your own use.
It is not supported; it works fine for my own use, and no enhancements are intended or should be requested.