Solved

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

Posted on 2016-10-17
3
34 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)
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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

In this article we will learn how to backup a VMware farm using Nakivo Backup & Replication. In this tutorial we will install the software on a Windows 2012 R2 Server.
This problem is more common than not and I will show you some things to check to solve this problem.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

772 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