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



 Here's how I would handle this..

     p next_eid        b
     d next_eid        pi            11s 0

     d result          s             11s 0

     c/exec sql
     c+  Select Max(EID) into :result from wmerlgp
     c/end-exec
      /free
         if SQLSTT='02000';
             result = 1;
         else;
             result += 1;
         endif;
         return result;
      /end-free
     p                 e


Thanks,
Tommy Holden


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Kurt Anderson
Sent: Wednesday, December 07, 2005 3:36 PM
To: RPG programming on the AS400 / iSeries
Subject: RE: RNF7701 - Data structure not allowed

This might be release specific, but at least on v5r2 (if memory serves
me correctly) you have to read a record into a data structure, not a
file. 

So instead of:
         readp wmerlg Q;

It would be something like:
         readp wmerlgRec Q;

Kurt Anderson
Application Developer
Highsmith Inc

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Rich Duzenbury
Sent: Wednesday, December 07, 2005 2:55 PM
To: RPG400-L
Subject: RNF7701 - Data structure not allowed

Hi all,

I'm getting a compile error on what looks like OK code to me.  I've
stripped the program down as small as possible to demonstrate the error,
which happens to occur on a V5R2 machine.

What I want to do is load the WMERLG record format fields, then, locate
the highest EID in the file, add one to it, and attempt to use it for
the new record key.  I don't want the 'next_eid' routine to clobber the
E* fields, hence the need for reading into a data structure.

Here is the file, WMERLGP:
     A                                      UNIQUE
     A          R WMERLG
     A            EID           11P 0
     A            EACCT#        11P 0
     A            EAPLNM        20A  
     A            EAPFNM        12A  
     A            EAPITL         1A  
     A            EVISDT          Z  
     A            EREVDT          Z  
     A            EUSRID        10A  
     A            ERSTS          1A  
     A          K EID

And the code:
     H dftactgrp(*no) actgrp(*caller)
     H OPTION(*SRCSTMT:*NODEBUGIO)

     FWMERLGP   if a e           k disk

     d Q             e DS
EXTNAME(WMERLGP:WMERLG:*INPUT)
     d                                     QUALIFIED

     d next_eid        pr            11s 0
     d $err            s               n

      /free
         $err = '0';
         dow $err = '0';
             EID = next_eid();
             write(e) WMERLG;
             $err = %error;
         enddo;
         *inlr = '1';
      /end-free

     p next_eid        b
     d next_eid        pi            11s 0

     d result          s             11s 0

      /free
         setgt *hival wmerlgp;
         // read into a ds so as not to disturb the
         // global file fields
         readp wmerlg Q;
     // RNF7701 here!
         if %eof(wmerlgp);
             result = 1;
         else;
             result = q.eid + 1;
         endif;
         return result;
      /end-free
     p                 e


The error is RNF7701, 'Data structure is not allowed for the operation',
and lists the line of code that does 'readp wmerlg Q'.

I've tried EXTNAME(WMERLGP), EXTNAME(WMERLGP:*INPUT),
EXTNAME(WMERLGP:*OUTPUT) and also with and without the 'QUALIFIED',
still get the error.

PS - I tried to put the code on the code.midrange.com app
(http://code.midrange.com), but I receive the following error, 'Access
denied for user 'nopaste'@'localhost' (using password: YES)'

If you have any ideas, let me know, please.

Thanks.

Regards,
Rich


--
This is the RPG programming on the AS400 / iSeries (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:

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.