Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I have some old programs that were

Status
Not open for further replies.

BeJay

Programmer
Feb 26, 2001
1
US
I have some old programs that were used on MVS which need to be adapted to Fujitsu Cobol 5.0 on the PC. My problem is variable length files that do not specify the length within the file. The data file contains two formats - A and B. Format A had a record length of 500 which is followed by 1 to 99 format B records that have a length of
125. These repeat. The data is sequential (no delimiters).

Using the programs with the following two samples results in an invalid delimiter error (inv-delmtr) when I compile the program.
Sample 1.
FILE-CONTROL.
SELECT INFILE ASSIGN TO FILEIN.
DATA DIVISION.
FILE SECTION.
FD INFILE
BLOCK CONTAINS 0 RECORDS
RECORDING MODE IS V
LABEL RECORDS ARE STANDARD.
01 IN-RECORD.
05 FILE-KEY
10 FLD001-IN PIC X(06).
10 FLD002-IN PIC X(05).
10 FLD003-IN PIC X(05).
10 FLD004-IN PIC X(10).
05 FORMAT-IN PIC X(001).
05 FILLER PIC X(473).

01 HISTORY-FMTA-RECORD PIC X(500).
01 HISTORY-FMTB-RECORD PIC X(125).

Sample 2.
FILE-CONTROL.
SELECT INFILE ASSIGN TO FILEIN.
DATA DIVISION.
FILE SECTION.
FD INFILE
BLOCK CONTAINS 0 RECORDS
RECORDING MODE IS V
RECORD CONTAINS 125 TO 500 CHARACTERS
LABEL RECORDS ARE STANDARD
DATA RECORDS ARE IN-RECORD
HISTORY-FMTA-RECORD
HISTORY-FMTB-RECORD.

Read Section (same one used in both of above samples).
250-READ SECTION.
READ INFILE
AT END MOVE 'YES' TO EOF-SW
GO TO 250-EXIT.
ADD 1 TO REC-READ-CTR.

IF FORMAT-IN = 'A'
MOVE HISTORY-FMTA-RECORD TO WS-FMTA-RECORD
GO TO 250-EXIT.

IF FORMAT-IN = 'B'
MOVE HISTORY-FMTB-RECORD TO WS-FMTB-RECORD
ELSE
ADD 1 TO FORMAT-ERR-CTR.

Does anyone have an example of how these should be rewritten.

Thanks
BJ
 
Hi BeJay,

When the compiler gives you the error, which line is it pointing to, if at all?

How do you know that variable length records are the problem?

Does your compiler support "RECORDING MODE IS V"? I think you should remove that clause. You also may not need "BLOCK CONTAINS 0 RECORDS" at all.

Recompile and let us know what happened.

Dimandja


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top