• Subject: RE: Variable length records and network files
  • From: cmassoglia@xxxxxxxxxxxxxxxx (Charles L. Massoglia)
  • Date: Sat, 16 May 1998 13:55:07 -0400

You could use an RPG program compiled with CVTOPT(*VARCHAR) as follows:

PF DDS for PAYDET file:
       R PAYDET1
 * specify the maximum length of 251 for the field.
 * specify the typical length on the VARLEN parameter
         PAYDTA      251A         VARLEN(8)

RPG where INPUT is the 251 byte fixed length file you receive:

FINPUT   IF  F         251        DISK
FPAYDET  O   E                    DISK

IINPUT  NS
I                              1 251 INPUT

 * Note PAYDTA field length in program is 253, 2 bytes more than the 251 in DDS
I              DS
I                              1 253 PAYDTA
I                           B  1   20LENGTH
I                              3 253 OUTPUT

C                   MOVEL    INPUT        OUTPUT
C        ' '        CHEKR    OUTPUT       LENGTH
C                   WRITE    PAYDET1

A variable length field is defined at 2 characters larger than the maximum
length in RPG.  The first 2 bytes represents the actual data length in binary.

I have not compiled this so please pardon any errors.  Hope this helps.

>>> -----Original Message-----
>>> From:       Tony.Minehan@hr-m.b-m.defence.gov.au
>>> [SMTP:Tony.Minehan@hr-m.b-m.defence.gov.au]
>>> Sent:       Friday, May 15, 1998 6:47 AM
>>> To: midrange-l@midrange.com
>>> Subject:    Variable length records and network files
>>>
>>>
>>>
>>>      G'Day all,
>>>
>>>      Every 2 weeks we are sent a file from another government agency.
>>> The
>>>      file is text only and the record length ranges from 8 bytes (most
>>>
>>>      records) to 251 bytes (very few, but very important records). An
>>>      average number of records is around 6 million. The file is sent
>>> from a
>>>      S370 via SNA (FTP is not an option at present) and arrives here
>>> as a
>>>      network file. Currently we receive the file into a single field
>>> 251
>>>      byte text file and then do our processing. Over the next couple
>>> of
>>>      fortnights, the file is likely to grow to around 65 million
>>> records.
>>>
>>>      I've defined a new file as follows:
>>>
>>>       R PAYDET
>>>         PAYDET       251A         VARLEN
>>>
>>>      and tried to receive the network file into this in order to save
>>> DASD
>>>      space. The receive falls over with a data mapping error (CPF5035)
>>> and
>>>      an error code of 14 which reads:
>>>
>>>        14 -- The length of a variable length field is not valid or the
>>> data
>>>      in a substring variable is not valid.
>>>
>>>      Also using a CPYF to the filed defined above fails with the same
>>>      message. We are on V3R2. Any ideas?
>>>
>>>      Tony Minehan
>>+---
>>| This is the Midrange System Mailing List!
>>| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
>>| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
>>| Questions should be directed to the list owner/operator: david@midrange.com
>>+---
>
>
>
>+---
>| This is the Midrange System Mailing List!
>| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
>| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
>| Questions should be directed to the list owner/operator: david@midrange.com
>+---
>
>


Charlie Massoglia, Massoglia Technical Consulting, Inc.
PO Box 1065, Okemos, MI 48854, USA
517-676-9700  Fax: 517-676-1006  EMAIL: cmassoglia@voyager.net


+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


This thread ...


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

This mailing list archive is Copyright 1997-2019 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 here. If you have questions about this, please contact [javascript protected email address].