× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



The Sev 20 warning is because you forgot to factor in the 2 byte length for the varying length field. Really you should be coding VARLEN(170) if you anticipate that to be the average.

But the cause of the problem is probably that you have not set the length of the varying length field - so even though you place the data in the buffer a zero length is what will be written. I can't recall what the generated name for the field will be but a look at the COBOL listing will tell you. You also need to move the data to the field name - not the rec. Or if you want to use a WS definition for the field then it must also have the field length defined. Using COPY DDS for its definition is the best approach.


Jon Paris

www.Partner400.com
www.SystemiDeveloper.com



On Nov 29, 2010, at 1:39 PM, <msmith6@xxxxxxxxxxxx> wrote:


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.


--
This is the COBOL Programming on the iSeries/AS400 (COBOL400-L) mailing list
To post a message email: COBOL400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/cobol400-l
or email: COBOL400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/cobol400-l.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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

This mailing list archive is Copyright 1997-2024 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.