Page 1 of 1
Significance of the sequence number in COBOL.
Posted: Sat Nov 28, 2015 12:03 pm
by alpna
I read that Cobol kept the first 6 positions for a line sequence number. Column 7 was a continuation / comment / debug / form-feed. Area "A", or Columns 8-11, indicated certain special language artifacts like 01 levels, section or paragraph names. Columns 73 - 80 were for OS sequence numbers.
i have also notied some programs have it some don't; some have them in no particular sequence... when a program can compile and run with or without them, what is their use for the program?
Re: Significance of the sequence number in COBOL.
Posted: Sat Nov 28, 2015 6:47 pm
by nicc
Sequence numbers are irrelevant nowadays. They were useful if you dropped the cards that the code was punched on so that you could put them back together in the correct sequence.
Re: Significance of the sequence number in COBOL.
Posted: Sun Nov 29, 2015 1:30 am
by ApexNC
Whenever I encounter a source deck with all numerics in cols 1-7, one of the first things I do is to immediately overlay those lines with spaces. I actually wrote a source code processing program to do exactly that. Better to have nothing at all than have something that means nothing.
Re: Significance of the sequence number in COBOL.
Posted: Sun Nov 29, 2015 6:02 pm
by nicc
I hope that was cols 1 - 6 and not 7!
We used cols 1-6 for notes e.g. to flag lines that were in for DEBUG or TEST (and col 7 = D).
Re: Significance of the sequence number in COBOL.
Posted: Mon Nov 30, 2015 2:21 pm
by alpna
So basically they are of no use now a days?
Re: Significance of the sequence number in COBOL.
Posted: Mon Nov 30, 2015 2:22 pm
by alpna
ApexNC wrote:I actually wrote a source code processing program to do exactly that.
Can you please share the code, if it can be shared here?
Re: Significance of the sequence number in COBOL.
Posted: Mon Nov 30, 2015 3:27 pm
by nicc
How about a two line macro that simply changes any non-blank character in cols 1 to 6 to blank? The first line would be the MACRO header.
Re: Significance of the sequence number in COBOL.
Posted: Mon Nov 30, 2015 8:39 pm
by William Collins
In the ISPF Editor:
Code: Select all
NUMBER ON COBOL
UNNUM
NUMBER <back to previous state, if necessary>
That will clobber anything in columns one to six. Not a lot of people know about NUMBER ON COBOL, so just tossing it in.
I have seen columns one to six used for various things, never really with much point.
You can have columns one to six checked by the compiler, or contents entirely ignored. See compiler options NUMBER and SEQUENCE.
Re: Significance of the sequence number in COBOL.
Posted: Mon Dec 28, 2015 11:59 pm
by ApexNC
alpna wrote:ApexNC wrote:I actually wrote a source code processing program to do exactly that.
Can you please share the code, if it can be shared here?
Here's the essential code (for fixed-length COBOL source files), based on the recently posted GET/PUT Assembler shell format (posted under the Convert "VB to FB file but with padding" topic
Re: Convert VB to FB file but with padding. (Post by Anonymous #8285) ):
Code: Select all
BLKSEQ CSECT
BAKR 14,0
LR 12,15
USING BLKSEQ,12
PRINT NOGEN
OPEN (COBSRC,UPDAT) OPEN COBOL SOURCE FILE
LOOP GET COBSRC R1 -> COBOL SOURCE RECORD
TRT 0(6,1),TRTBL COBOL SEQUENCE ALL NUMERIC?
BNZ LOOP NO: GO GET NEXT COBOL SOURCE RECORD
MVC 0(6,1),SPACES YES: OVERLAY SEQUENCE NUMBER WITH SPACES
PUTX COBSRC UPDATE RECORD
B LOOP DO WHILE MORE COBOL SOURCE RECORDS
EOF CLOSE COBSRC AT END, CLOSE COBOL SOURCE FILE
PR RETURN
COBSRC DCB DSORG=PS,DDNAME=COBSRC,MACRF=(GL,PL),EODAD=EOF
* NEXT 256 BYTES IS THE TRANSLATE TABLE FOR TRT
TRTBL DC CL240' ' FOR X'00' TO X'EF'
DC XL10'00' FOR X'F0' TO X'F9' (ZONED DECIMAL DIGITS)
SPACES DC CL6' ' FOR X'FA' TO X'FF'
END
For variable length COBOL source files, change "0(6,1)" to "4(6,1)" in the TRT and MVC instructions.
Here's the JCL:
Code: Select all
// EXEC PGM=BLKSEQ
//COBSRC DD DISP=SHR,DSN=<dsname of COBOL source file>
Re: Significance of the sequence number in COBOL.
Posted: Sat Jan 02, 2016 8:16 am
by alpna
ApexNC wrote:alpna wrote:ApexNC wrote:I actually wrote a source code processing program to do exactly that.
Can you please share the code, if it can be shared here?
Here's the essential code (for fixed-length COBOL source files), based on the recently posted GET/PUT Assembler shell format (posted under the Convert "VB to FB file but with padding" topic
Re: Convert VB to FB file but with padding. (Post by Anonymous #8285) ):
Code: Select all
BLKSEQ CSECT
BAKR 14,0
LR 12,15
USING BLKSEQ,12
PRINT NOGEN
OPEN (COBSRC,UPDAT) OPEN COBOL SOURCE FILE
LOOP GET COBSRC R1 -> COBOL SOURCE RECORD
TRT 0(6,1),TRTBL COBOL SEQUENCE ALL NUMERIC?
BNZ LOOP NO: GO GET NEXT COBOL SOURCE RECORD
MVC 0(6,1),SPACES YES: OVERLAY SEQUENCE NUMBER WITH SPACES
PUTX COBSRC UPDATE RECORD
B LOOP DO WHILE MORE COBOL SOURCE RECORDS
EOF CLOSE COBSRC AT END, CLOSE COBOL SOURCE FILE
PR RETURN
COBSRC DCB DSORG=PS,DDNAME=COBSRC,MACRF=(GL,PL),EODAD=EOF
* NEXT 256 BYTES IS THE TRANSLATE TABLE FOR TRT
TRTBL DC CL240' ' FOR X'00' TO X'EF'
DC XL10'00' FOR X'F0' TO X'F9' (ZONED DECIMAL DIGITS)
SPACES DC CL6' ' FOR X'FA' TO X'FF'
END
For variable length COBOL source files, change "0(6,1)" to "4(6,1)" in the TRT and MVC instructions.
Here's the JCL:
Code: Select all
// EXEC PGM=BLKSEQ
//COBSRC DD DISP=SHR,DSN=<dsname of COBOL source file>
Thanks so much for you help ApexNC.