× 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.



and they are almost all exclusively with variable length records!

Variable length records have been supported by COBOL on the System i for
some time now - BUT - the requirements for the underlying external
description of the physical file are fairly strict.

The physical file must be described as having zero or more fixed length
fields followed by one - and one only - variable length field.  I believe
that if you compile the program with the option to create physical files for
you (not the recommended setting) the compiler should create the file if it
does not exist.  This process is all described in the manuals.

I haven't got time to dig out a full example but if you wanted a physical
file with a fixed portion of 200 bytes and maximum length of 1200 bytes, you
could code the DDS as:

FLD1  200A
FLD2 1000A VARLEN(400).

In this example we are assuming that the majority of records will be
contained within 600 bytes.  This saves wasting 600 bytes on records that
don't need it.

Biggest problem with this approach is that you can't use external
descriptions for the field(s) in the variable portion.

When considering the requirements for files on the system, you have to
remember that the records are database rows.  The system offers the
flexibility of using them as both flat files and database tables - which is
fantastic - but it does mean that things t=like variable length records
(which typically are varying because of a repeating series of fields (i.e.
an array)) are strictly verboten in the database world.  Hence the native
support is a bit of a hack.


Jon Paris
Partner400

www.Partner400.com 


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.