Solved

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

Posted on 2016-10-17
3
12 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
  • 3
3 Comments
 
LVL 27

Assisted Solution

by:tliotta
tliotta earned 500 total points (awarded by participants)
Comment Utility
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)
Comment Utility
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
Comment Utility
Corrected code that compiles without error clarifies simple descriptive comments about what caused errors.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Following basic email etiquette rules will help you write a professional email and achieve a good, lasting impression with your contacts.
Possible fixes for Windows 7 and Windows Server 2008 updating problem. Solutions mentioned are from Microsoft themselves. I started a case with them from our Microsoft Silver Partner option to open a case and get direct support from Microsoft. If s…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

728 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now