Significance of the sequence number in COBOL.

OS/VS COBOL, COBOL II, Enterprise COBOL for z/OS. OpenCOBOL and OOCobol.
Post Reply
alpna
Registered Member
Posts: 56
Joined: Fri Jun 21, 2013 10:35 pm

Significance of the sequence number in COBOL.

Post 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?
nicc
Global Moderator
Global Moderator
Posts: 691
Joined: Wed Apr 23, 2014 8:45 pm

Re: Significance of the sequence number in COBOL.

Post 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.
Regards
Nic
User avatar
ApexNC
Registered Member
Posts: 10
Joined: Sun Dec 08, 2013 7:03 pm
Contact:

Re: Significance of the sequence number in COBOL.

Post 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.
nicc
Global Moderator
Global Moderator
Posts: 691
Joined: Wed Apr 23, 2014 8:45 pm

Re: Significance of the sequence number in COBOL.

Post 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).
Regards
Nic
alpna
Registered Member
Posts: 56
Joined: Fri Jun 21, 2013 10:35 pm

Re: Significance of the sequence number in COBOL.

Post by alpna »

So basically they are of no use now a days?
alpna
Registered Member
Posts: 56
Joined: Fri Jun 21, 2013 10:35 pm

Re: Significance of the sequence number in COBOL.

Post 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?
nicc
Global Moderator
Global Moderator
Posts: 691
Joined: Wed Apr 23, 2014 8:45 pm

Re: Significance of the sequence number in COBOL.

Post 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.
Regards
Nic
William Collins
Global Moderator
Global Moderator
Posts: 490
Joined: Sun Aug 25, 2013 7:24 pm

Re: Significance of the sequence number in COBOL.

Post 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.
User avatar
ApexNC
Registered Member
Posts: 10
Joined: Sun Dec 08, 2013 7:03 pm
Contact:

Re: Significance of the sequence number in COBOL.

Post 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>
alpna
Registered Member
Posts: 56
Joined: Fri Jun 21, 2013 10:35 pm

Re: Significance of the sequence number in COBOL.

Post 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.
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “IBM COBOL, GnuCOBOL (OpenCOBOL), OOCobol.”