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



You MUST not use the E (external) file type if you intend to use IO with
structures, IIRC. You have to use "F" and state the record length. The
structure size must then match this record length exactly.

Usually I do this with qualified data structures. You'll probably want to
(or use the prefix thing with a really short prefix). For the prefix you
know you can REMOVE letters from the beginning of the external field name?
LIke when your fields all start with MF (master file) you could PREFIX(
'I_':2) or PREFIX('O_':2) and replace that MF with either I_ or O_ (input,
output).

Stu





On Wed, Nov 11, 2009 at 08:53, Kurt Anderson
<kurt.anderson@xxxxxxxxxxxxxx>wrote:

Hi Glenn,

Unless I missed it, I don't see where your code loads the I data structure.
Here's a quick (untested) sample of how I would do it.

FFile1 IF E K Disk
FFile2 UF A E K Disk Rename( FileRec: FileRec2 )

D dsFile1 DS LikeRec( FileRec )
D dsFile2 DS LikeRec( FileRec2: *output )

/free

DoU %eof( File1 );
Read File1 dsFile1;
If not %eof( File1 );
dsFile2 = dsFile1;

SetLL dsFile1.key File2;
If %equal( File2 );
Update FileRec2 dsFile2;
Else;
Write FileRec2 dsFile2;
EndIf;

EndIf;
EndDo;


- Kurt Anderson

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Gundermann, Glenn / Kuehne + Nagel / Tor ZI-A
Sent: Wednesday, November 11, 2009 6:59 AM
To: rpg400-l@xxxxxxxxxxxx
Subject: Reading directly into a DS

Hi folks,

I'm going in circles here and was hoping someone wouldn't mind helping me.
I'm trying to read data directly into a DS and then write the data to
another file, either with an update or a write, using the data structure.
I know there are different styles, like READ file-name ds-name, and I'm not
sure which is the preferred style.

First of all, we're on V5R4.
This program reads the records from an intermediate file and either updates
or adds them to the master file.
The intermediate file was created using CRTDUPOBJ of the master file, which
is why the record format is renamed.
The files each have 7 fields, of course with the same name.

1. I tried having a meaningful prefix on the F-spec but I received a
compile error RNF2356, I think because there is a limit of 13 to the field
name length.
What can I do to improve this?

2. I'm getting compile time errors:
*RNF7030 30 7 The name or indicator is not defined.
(I.field1, I.field2, etc. for the 7 fields in the file)
*RNF7701 20 2 The data structure is not allowed for the operation.
(Update ACCDOCR I and Write ACCDOCR I)

Any tips would be most appreciated.

Yours truly,

Glenn Gundermann
Work: (905) 501-6596
Cell: (416) 317-3144
glenn.gundermann@xxxxxxxxxxxxxxxx<mailto:glenn.gundermann@xxxxxxxxxxxxxxxx




Here is my code (sans header comments):

h option(*srcstmt:*nodebugio)

// Intermediate eFile Document Code file in arrival sequence.
FACCDOCCOD2IF E DISK Rename(ACCDOCR:ACCDOCR2)
F Prefix('I.': 3)

// eFile Document Code file by Document Code.
FACCDOCCODLUF A E K DISK

//------------------------------------------------------
// Parameters.
//------------------------------------------------------

D CAEFL004 pr ExtProc('CAEFL004')
D CAEFL004 pi

//------------------------------------------------------
// Vaiable Declarations.
//------------------------------------------------------

D I e ds ExtName(ACCDOCCODE)
D Qualified

//------------------------------------------------------
// Start of Executable Code.
//------------------------------------------------------

/free

Read ACCDOCCOD2;

Dow Not %eof(ACCDOCCOD2);
Chain I.ACCTYPND ACCDOCCODL;

If %found(ACCDOCCODL);
Update ACCDOCR I;
Else;
Write ACCDOCR I;
EndIf;

Read ACCDOCCOD2;

EndDo;

*InLr = *On;
Return;

/end-free

________________________________
To learn more about Kuehne + Nagel Ltd, please visit our website at:
www.kuehne-nagel.com For the Kuehne + Nagel email disclaimer, visit:
http://www.kn-portal.com/material/Electronic_Email_Disclaimer_English_French.pdf



Visitez le site internet de Kuehne + Nagel Lt?e: www.kuehne-nagel.comNotre d?charge de responsabilit? est disponible comme suit:
http://www.kn-portal.com/material/Electronic_Email_Disclaimer_English_French.pdf
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.

--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.