******************************************************************* * This page contains new information, not part of original note. * * See the lines below the ================ ruler. 38 lines. * ******************************************************************* Date: Tue, 15 Jun 1999 14:45:09 -0500 (CDT) From: MARK JACOBSON Subject: Use column 1, row 1, Terminal format... To: 810-034-01@uni.edu Hi COBOL students, If you write your COBOL programs using terminal format instead of ANSI format on chaos, you can use columns 1-4 as AREA A and use columns 5 through 80 as AREA B. COLUMN 1 can be used with * for a comment, so it functions as column 7 as well as column 8 for the ANSI format of cobol. 1-6 7 8-11 12-72 73-80 ** ANSI Format ** card * AREA AREA Program or or / A B name line - number ** Terminal format ** is columns 1-4 for AREA A, columns 5 onward for AREA B and column 1 for using * to indicate a comment line, or using a / or - and other special indicators for the compiler. This is very important to be aware of. The cobol compiler on chaos tries to be "smart" and guess whether the source file is in terminal format or in ANSI format. It does this by checking to see if column 1 of line 1 is blank or not. Moral: DO NOT INDENT YOUR FIRST STATEMENT. BE sure to have the I of IDENTIFICATION or the * of a comment in column 1. Even though columns 2, 3 and 4 are also AREA A in terminal format, when the cobol compiler sees that column 1 is blank, it will guess the entire program is ANSI format. 1 2 3 4 1234567890123456789012345678901234567890 IDENTIFICATION DIVISION. PROGRAM-ID. JUN8PR1. ENVIRONMENT DIVISION. I modified the above jun8.cob example program by indenting the 1st line so the I starts in column 2 instead of column 1. The cobol compiler on chaos guesses WRONGLY that the file jun8.cob is in ANSI format. Here are the 1st 7 lines of 64 lines of compiler error messages that resulted from the space!! -------- <34 chaos:~/cobol >cobol jun8.cob jun8.cob, line 1: Illegal indicator: 'T' jun8.cob, line 1: PROGRAM-ID expected, IFICATION found jun8.cob, line 1: Warning: Area A should be blank jun8.cob, line 1: Warning: '.' expected, DIVISION found jun8.cob, line 1: PROCEDURE expected, DIVISION found jun8.cob, line 2: Illegal indicator: 'R' jun8.cob, line 2: Verb expected, TESTING found 57 more lines of error messages were not shown, in honor of the steak sauce. If you were to submit a program on COBRA that were written in ANSI format, you have to enter an extra option on the command line. COBRA COBOL assumes all COBOL programs are in terminal format and requires the programmer to tell it otherwise when you try to compile your program. COBOL JUN8.COB <---- On iceman or viper or cobra assumes the JUN8.COB COBOL obeys the terminal format, ie area A is cols 1-4 and AREA B is cols 5-80. ======================================================================== COBOL /ANSI_FORMAT jun8ansi.cob is how to compile a file written in ANSI format on cobra (or viper or iceman) COBOL jun8.cob is all that is needed to compile the default terminal format program. You have this on a handout from June 8th. COBOL jun8 is exactly the same as COBOL /NOANSI_FORMAT jun8 ---------- ------------------------- since /NOANSI is the (D) default option when using the COBOL command on VMS (cobra). Here is part of the output of HELP COBOL /ANSI ------------------------------------------------------------------------- COBOL /ANSI_FORMAT /ANSI_FORMAT /NOANSI_FORMAT (D) Indicates that the source program is in conventional ANSI format. The compiler then expects 80-character card image records with optional sequence numbers in character positions 1 through 6, indicators in position 7, Area A beginning in position 8, Area B beginning in position 12, and the identification area in positions 73 through 80. The default, /NOANSI_FORMAT, indicates that the source program is in Digital terminal format, where Area A begins in position 1, Area B begins in position 5, and the source program records do not have line numbers. jun8.cob in jun8ansi.cob is in terminal format the ANSI format --------------- ------------------ cobol jun8 cobol/ansi_format jun8ansi link jun8 link jun8ansi run jun8 run jun8ansi