Solved

ERROR RNF0257 :Form-Type entry for main procedure not valid or out of  sequence.

Posted on 2016-10-17
3
59 Views
Last Modified: 2016-11-19
Hi,
I'm a beginner in AS-400. I was just trying out this code to understand the concept behind compile time  array . However, every time I compile my code I get
 ERROR RNF0257 :Form-Type entry for main procedure not valid or out of  sequence for the below lines
**CTDARA DARR1                                      
   JANUARY;                                    
  FEBRUARY;                                        
  MARCH;                                            
  APRIL;                                            
  MAY;                                              
  JUNE;                                            
  JULY;                                            
  AUGUST;                                          
  SEPTEMBER;                                        
  OCTOBER;                                          
  NOVEMBER;                                        
  DECEMBER;

The entire code is :
DDARR1            S             10A   DIM(6) CTDATA PERRCD(1)          
DN                     S               2P 0 INZ(1)                            
DMONTH          S             10A                                    
C                   DOW       N=6                                      
C                   EVAL      MONTH=DARR1(N)                            
C     MONTH         DSPLY                                              
C                   EVAL      N = N+1                                  
C                   ENDDO                                              
C                   SETON                                            LR
**CTDARA DARR1                                      
   JANUARY;                                    
  FEBRUARY;                                        
  MARCH;                                            
  APRIL;                                            
  MAY;                                              
  JUNE;                                            
  JULY;                                            
  AUGUST;                                          
  SEPTEMBER;                                        
  OCTOBER;                                          
  NOVEMBER;                                        
  DECEMBER;
0
Comment
Question by:EVE SAWYER
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
3 Comments
 
LVL 27

Assisted Solution

by:tliotta
tliotta earned 500 total points (awarded by participants)
ID: 41846425
Since the source is not formatted using the {code} option, it can't be certain. But first requirement is that the "**CTDATA" record and the data records begin in position 1. And second, you're showing a "**CTDA R A" record and not "**CTDATA".
0
 
LVL 27

Accepted Solution

by:
tliotta earned 500 total points (awarded by participants)
ID: 41867284
To clarify, this version compiles successfully:
     DDARR1            S             10A   DIM(12) CTDATA PERRCD(1)
     DN                S              2P 0 INZ(1)
     DMONTH            S             10A
     C                   DOW       N=6
     C                   EVAL      MONTH=DARR1(N)
     C     MONTH         DSPLY
     C                   EVAL      N = N+1
     C                   ENDDO
     C                   SETON                                            LR
**CTDATA DARR1
JANUARY;
FEBRUARY;
MARCH;
APRIL;
MAY;
JUNE;
JULY;
AUGUST;
SEPTEMBER;
OCTOBER;
NOVEMBER;
DECEMBER;

Open in new window

It won't actually do anything, though, due to logic errors (and one or two additional bugs).

First logic error is that the DOW (doWhile) loop is testing for N=6. Since N is initialized to 1, the test will never be true. It should either have a DOU (doUntil) or the test should be N<6 (or some appropriate value.

The DIM() for DARRA1 also needs to be 12 since 12 array values were listed. (Extra values could be removed, but that doesn't seem likely.)
0
 
LVL 27

Expert Comment

by:tliotta
ID: 41894052
Corrected code that compiles without error clarifies simple descriptive comments about what caused errors.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Had a business requirement to store the mobile number in an environmental variable. This is just a quick article on how this was done.
Invest in your employees with these five simple steps to improve employee engagement and retention.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question