Solved

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

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

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

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

This article is in regards to the Cisco QSFP-4SFP10G-CU1M cables, which are designed to uplink/downlink 40GB ports to 10GB SFP ports. I recently experienced this and found very little configuration documentation on how these are supposed to be confi…
Ever wonder what it's like to get hit by ransomware? "Tom" gives you all the dirty details first-hand – and conveys the hard lessons his company learned in the aftermath.
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…

627 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