LIKEDS with DIM() in RPGLE

1300 pts.
Tags:
as400 v5r3
RPGLE Program
Hi Gurus, I need some help. I have the following code and it can not be compiled. It says: *RNF7030 30        596700  The name or indicator ADDRESS is not defined. Here is my code:

D sndemail        pr                  Extpgm('SNDEMAIL')

D  subject                      80A   const

D  htmlmsg                    5000a   const

D  toaddrs                            likeds(emailaddrs) dim(20)

D  fromaddr                    100a   const

D  fromname                    100a   const





demailaddrs       ds                  qualified inz

D  count                            4b 0

D  to_type                         3a

D  name                        100a

D  address                      50a

The fields COUNT, TO_TYPE, NAME and ADDRESS are getting the 7030 errors. When I'm putting in to the D spec, then I'm getting: *RNF3315 20   The Name entry is already defined on a Definition Specification; defaults to blanks. Any suggestion? Thanks, YuVa

Software/Hardware used:
V5R3

Answer Wiki

Thanks. We'll let you know when a new response is added.

BigKat;

I already tried your suggestion, but unfortunately I’m getting there the same RNF7030 error for the fields within the emailaddrs DS:

Discuss This Question: 15  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • philpl1jb
    qualified field names include the DS demailaddrs.address is the field name. Phil
    49,980 pointsBadges:
    report
  • philpl1jb
    and in an array demailaddrs(1).address
    49,980 pointsBadges:
    report
  • YuVa47
    Thank you Phil, Unfortunately I'm getting the same errors. Here is the code where I'm trying to fill the data:
         For x = 1 to 20;
           select;
             when x > 4;
               leave;
             when x = 1;
               toaddrs.emailaddrs(x).e_type = 'TO ';
               toaddrs.emailaddrs(x).name   = *blanks;
               toaddrs.emailaddrs(x).address= 'yehudav@bagir.com';
             when x = 2;
               toaddrs.emailaddrs(x).e_type = 'TO ';
    
    1,300 pointsBadges:
    report
  • philpl1jb
    toaddrs(x).to_type = ‘TO ‘; From the structure above toaddrs is the name of a qualified data structure that is like the data structure emailaddrs. And the subfield names seemed to have changed from the structure above the the code sample. Phil
    49,980 pointsBadges:
    report
  • TomLiotta
    *RNF7030 30 596700 Statement 596700 is a long, long way down the source for an RPG procedure. I wouldn't expect it to refer to a D-spec, so I assume it's a C-spec. Can you show us that emailaddrs is defined within the same scope as statement 596700? Tom
    125,585 pointsBadges:
    report
  • YuVa47
    Phil, You are correct but it was wrong typing from my side. The e_type is to_type. Tom, I'm not really understanding what you mean. In my original question I included the code both for the ExtPgm('SNDEMAIL') and the DS for emailaddrsDS. Anyway here are the codes around statement 596700:
       If  %scan('CS':SRNMBR)<>0 and stsemail<>'1';
         fromaddr = '*CURRENT';
         fromname = '*CURRENT';
         srnumcs  = srnmbr;
    
         For x = 1 to 20;
           select;
             when x = 1;
               toaddrs.emailaddrs(x).to_type = 'TO ';
               toaddrs.emailaddrs(x).name   = *blanks;
               toaddrs.emailaddrs(x).address= 'yehudav@bagir.com';
             when x = 2;
               toaddrs.emailaddrs(x).to_type = 'TO ';
               toaddrs.emailaddrs(x).name   = *blanks;
    
               ...
           EndSl;
         EndFor;
    
         Monitor;
           sndemail (subject:htmlmsg:toaddrs:fromaddr:fromname);
           stsemail ='1';
         on-error;
           stsemail = ' ';
         Endmon;
      
        Endif;
    
    
    
    Is it what you mentioned Tom?
    1,300 pointsBadges:
    report
  • BigKat
    I think this is what you want:
         For x = 1 to 20;
           select;
             when x > 4;
               leave;
             when x = 1;
               toaddrs(x).to_type = ‘TO ‘;
               toaddrs(x).name   = *blanks;
               toaddrs(x).address= ‘yehudav@bagir.com’;
             when x = 2;
               toaddrs(x).to_type = ‘TO ‘;
    
    8,210 pointsBadges:
    report
  • philpl1jb
    Tom asked about the scope of the declarations. You've shown us the 'D' specs Are they at the beginning of the program--making then global declarations Or are they at the beginning of this procedure--making them local declarations. Or are they at the beginning of another procedure -- making them invisible to the procedure that contains this code. Phil
    49,980 pointsBadges:
    report
  • TomLiotta
    There are many possible problems. The error message shows that there are almost 6000 source lines at least, so it's impossible to tell what actual errors there are. With that many source lines, especially when a PR shows that procedures are being prototyped, some errors could be explained by "scope" problems. There is no way for us to see what the scope of the definitions is by just seeing snippets. I wanted to be sure that "scope" hadn't been overlooked, so I only added the comment in case more needed to be looked at. However, my comment was added after Phil's original comment. His comment indicates a very likely source of the error, but the source lines that had the errors weren't shown. The RNF7030 error message in a listing will only show the lowest level name rather than the qualified name, so we can't tell about an error without both the error message and the source statements at the same time. We can't tell if the source line actually included qualification unless the source with the error is shown. Since emailaddrs is a qualified DS, you can't reference the subfields without qualification. That was the point of Phil's first comment from what I read. Now, after that, I don't see where toaddrs is defined. We're now missing the D-specs for it. So far, you have only shown it referenced under the PR. But where is it defined? You can't use the name without defining it first. The PR doesn't define it; it only reserves a parameter interface for it. Whatever you use for that parameter when you call the proc has to meet the requirements of the parameter, but the name under the PR is not relevant. Also, it looks as if you expect the PR parameter to reference an area of memory that can hold up to 20 copies of the emailaddrs DS. And the source shows emailaddrs with an index. But emailaddrs isn't an array, so an index doesn't really belong there. (It might be valid; I haven't tried it like that. But it won't matter until a D-spec is created for toaddrs.) Maybe that's enough rambling to help clear up some confusion. Ask about parts that need more discussion. Tom
    125,585 pointsBadges:
    report
  • YuVa47
    Thank you Tom the explanation. First of all this program is a monster and I shouldn't write it in that way. Everything is declared in the D spec as global variables.
    0122.00 D subject         s             80a
    0123.00 D htmlmsg         s           5000a
    0124.00 D toaddrs         s           3106a
    0125.00 d srnumcs         s              8a
    0126.00 D fromaddr        s            100a
    0127.00 D fromname        s            100a
    
    1,300 pointsBadges:
    report
  • TomLiotta
    0124.00 D toaddrs s 3106a Okay, so toaddrs is neither a DS nor an array. Since it's not a DS, it can't be qualified and it won't have any subfields. It's just a long character field. Consider changing this to a DS with likeds(emailaddrs) dim(20). Tom
    125,585 pointsBadges:
    report
  • YuVa47
    Tom, thank you for the suggestion, but how could I do that?
    1,300 pointsBadges:
    report
  • YuVa47
    Fixed, thank you all for your valuable suggestions. YuVa
    1,300 pointsBadges:
    report
  • TomLiotta
    Sometimes the easiest thing to do is to code a few lines into a test member to see what happens. I have a few dozen members in different languages that focus on different things. This is one that I have used to play around with DSs:
         D ds1             ds
         D  v1                            3
         D  v2                            3
    
         D ds2             ds                  qualified
         D  v3                            3
         D  v4                            3
    
         D ds3             ds                  likeds( ds2 )
          /free
    
           v1        = 'ABC' ;
           v2        = 'DEF' ;
           v3        = 'GHI' ;
           v4        = 'JKL' ;
           ds3.v4    = 'JKL' ;
           ds3.v5    = 'JKL' ;
    
           *inlr = *on ;
           return ;
          /end-free
    With little examples like that, you can always add or remove a line, add or remove a keyword, just to see what the compiler does. Sometimes it just takes seeing the error messages from a compile to help make things clearer. Other times you might scan down to the cross-reference in the listing to get clues. Tom
    125,585 pointsBadges:
    report
  • philpl1jb
    "We know that he did not come through the door, the window, or the chimney. We also know that he could not have been concealed in the room, as there is no concealment possible. When, then, did he come?" Arthur Conan Doyle, The Sign of the Four, 1890
    49,980 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following