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


  • Subject: Re: Matching Record (Was Need Help)
  • From: cmassoglia@xxxxxxxxxxx (Charlie Massoglia)
  • Date: Thu, 7 Aug 1997 09:21:37 -0400 (EDT)

>At 09:20 PM 8/6/97 -0400, PaulMmn wrote:
>>Well, here it is Old RPG II Programmer's Week...
>>Allright--- how many of you remember what an ADDROUT file was used for??
>
><raising hand>
>
>Hmmm... wasn't that used to sort files, where the actual sorted data was
>just the RRN of the file with the data?  You had to define some weird "E"
>spec's to link the addrout file to the master file.
>
Using a SORTR record sort required you to have enough disk space to hold not
only the input file but also a work file with a record length of the input
file plus the sort fields and output file with the same record length as the
input file.

The SORTA record address sort permitted you to perform a sort with minimal
disk space available.  The record length of the work file was the length of
the key fields and the record length of the output file was 3 bytes.  

Record address sorts are also called ADDROUT sorts (for address out).  The
output file from a SORTA contains relative record number offsets for the
records to be processed from the input file.  This is NOT a relative record
number, e.g. record at relative record number 1 in the sorted input file has
an offset of 0 in the ADDROUT output file.  

On the AS/400, the main value of the SORTA record address file is for S/36
environment coexistance.  When you are converting a S/36 system to native,
you can easily convert the RPG II programs to RPG III program described
files still driven by procedures.  You can externally describe the files and
continue to use them as program described files within an RPG III program
still drive by procedures with no modifications.  

But when you change the converted RPG III programs to use externally
described files, you have a problem with disk sort.  The output of a disk
sort is a program described file.

The simplest solution to this problem is to change the disk sorts to record
address sorts.  The record address file can be used to process an externally
described file in RPG III.  Thus the only changed required to the procedures
are to change the SORTR to a SORTA and eliminate the FDC data specifications.

The coding of an addrout file in RPG is very simple.  S/36 environment sorts
create a 3 byte output file.  Native FMTDTA sorts create a 4 byte output
file.  RPG III can define the ADDROUT file as either 3 or 4 bytes.  It makes
no difference how the ADDROUT file was created.

In following RPG/400 sample, the file ADDROUT is the output of a SORTA.  The
file OS6MASTR is the input to the sort and is processed in the RPG program
using the ADDROUT file.

*.. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... 8
FFilenameIPEAF....RlenLKlAIOvKlocEDevice+......Kexit++Entry+A....U1........
FOS6MASTRIP  E                    DISK
FADDROUT IR  F       3  3 T      EDISK

E....FromfileTofile++ArrnamN/rN/rbLenPDSArrnamLenPDSComments...............
E    ADDROUT OS6MASTR

The following RPG IV sample accomplishes the same thing.

*.. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... 8
FFilename++IPEASFRlen+LKlen+AIDevice+.File continuation++++++++++++++++++++
FOS6MASTR  IP   E             DISK
FADDROUT   IR   F    3     3 TDISK    RAFDATA(OS6MASTR)

In a native environment, you would generally use OPNQRYF to replace the
addrout sort.  You could also use a logical file access path.

SORTA was once an invaluable tool on the S/3, S/34, and S/36.  On the
AS/400, it only has value as a S/36 environment coexistance tool.


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 MAJORDOMO@midrange.com and specify            *
* 'unsubscribe MIDRANGE-L' in the body of your message.  Questions      *
* should be directed to the list owner / operator: david@midrange.com   *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


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