I am trying to create a variable length file on the iSeries. The records can vary from about 56 to 502 character with the average record length of about 170 characters. I have to use DDS for this rather than SQL, so here's my file description.

File is VARTEST
R VARRECORD
A fieldname 0502 VARLEN(56)


In the COBOL program

FILE-CONTROL.
SELECT VT
ASSIGN TO DATABASE-VARTEST
ORGANIZATION IS SEQUENTIAL
ACCESS MODE IS SEQUENTIAL
FILE STATUS IS WS-FILE-STAT.

FD VT
RECORD CONTAINS 56 TO 504 CHARACTERS.
01 VARIABLE-REC.
COPY DDS-ALL-FORMATS OF VARTEST.

WORKING-STRAGE SECTION.
01 WS-REC-1 PIC X(55) VALUE "1".


PROCEDURE DIVISION
OPEN OUTPUT VT.

MOVE WS-REC-1 TO VARRECORD.
WRITE VARIABLE-REC.


CLOSE VT.

When I compile I get the following Warnings (not 'errors')
2 MSGID: LNC0810 SEVERITY: 10 SEQNBR: 000300
Message . . . . : Module name 'VARRECTST1' does not match outermost
PROGRAM-ID name 'VARRECTST'. Accepted.
20 MSGID: LNC0852 SEVERITY: 0 SEQNBR: 001525
Message . . . . : RECORD clause gives range of record lengths. 506
will be used.
21 MSGID: LNC0853 SEVERITY: 20 SEQNBR: 001528
Message . . . . : Length 506 for record 'VARIABLE-REC' outside
specified range. Accepted.



I never get anything in the output file. Not sure if I have a stupid, D'oh COBOL problem or if there is something unusual in the messages/variable file that I'm not catching.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2021 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.