Skip to main content

Migrating OS/VS Cobol, Defining a FD with RECORD CONTAINS and RECORDING MODE clauses

  • March 2, 2017
  • 0 replies
  • 0 views

 After making various attempts at coding FDs for older OS/VS Cobol programs that were being migrated to Enterprise Cobol, the best answer was to first determine if the file in question was Fixed or Variable length and then use the coding shown below. The problem arose because the FD definitions contained both a RECORD CONTAINS and a RECORDING MODE clause.
 
 The following two FD definitions are the same except for the RECORDING MODE clause. The first is F (fixed) and the second is V (variable). When using a mainframe dialect, the compiler will issue the messages following each description. Notice the warning message for the record size. And for the case of a variable file, we issued a S-Level error.
 
       FD  FSISSUE
           RECORDING MODE IS F
           BLOCK CONTAINS 0 RECORDS
           RECORD CONTAINS 360 CHARACTERS
           DATA RECORD IS FS-ISSUE.
       1   FS-ISSUE.
        2   FS-DATA-RECS          PIC X(296).
        2   FS-OCCURS             PIC 9(4).
        2   FS-TABLE.
         3   COMPANION-NO         PIC X(10)
                                      OCCURS 0 TO 6 TIMES
                                      DEPENDING ON FS-OCCURS.

*     12  17 1204-I        BLOCK CONTAINS clause processed as comment.
*     21  62 1119-W        Record size (300) < minimum size given in FD statement (360)
 
 Specifying a RECORDING MODE of F causes all the records in the file to be the same length with a record length matching the largest character position defined even if there are multiple level-01 record descriptions entries with different lengths associated with the file, so the compiler issues a warning message, COBCH1119, saying the record size is less than the allowed size of 360 to remind the programmer.
 
       FD  FSISSUE
           RECORDING MODE IS V
           BLOCK CONTAINS 0 RECORDS
           RECORD CONTAINS 360 CHARACTERS
           DATA RECORD IS FS-ISSUE.
       1   FS-ISSUE.
        2   FS-DATA-RECS          PIC X(296).
        2   FS-OCCURS             PIC 9(4).
        2   FS-TABLE.
         3   COMPANION-NO         PIC X(10)
                                      OCCURS 0 TO 6 TIMES
                                      DEPENDING ON FS-OCCURS.

*     12  17 1204-I        BLOCK CONTAINS clause processed as comment.
*     15   9 1075-S        Invalid combination of RECORD and RECORDING MODE clauses.
*     21  62 1119-W        Record size (300) < minimum size given in FD statement (360)
 
 When a RECORDING MODE of V is specified, the records in the file can be either fixed or variable in length, but if both a RECORDING MODE of V and a RECORD CONTAINS clause are specified, the RECORD CONTAINS clause must specify the range of character positions from minimum to maximum in a variable length record meaning for this case one should use RECORD CONTAINS 300 to 360 CHARACTERS to avoid the COBCH1075 error message.


#EnterpriseDeveloper
#MFDS

0 replies

Be the first to reply!