Problem with 1:V - Array

Hi,

if I execute the following program, i get an error. I executed the program in batch.

Im just trying to make the called subprogram ready for being called by programs with different occurences of the array (#Tabelle). I used the 1:V notation in the called subprogram.

Maybe someone can explain to me why i get this error or give me a hint.

Thanks.

The output is:
IEA995I SYMPTOM DUMP OUTPUT 518
SYSTEM COMPLETION CODE=0C4 REASON CODE=00000011
TIME=11.03.28 SEQ=09523 CPU=0000 ASID=0096
PSW AT TIME OF ERROR 078D1000 91F8C222 ILC 4 INTC 11
ACTIVE LOAD MODULE ADDRESS=11F00000 OFFSET=0008C222
NAME=NATBATT
DATA AT PSW 11F8C21C - A0945850 30004050 10004119
GR 0: 00000000_7FFC3834 1: 00000000_12549004
2: 00000000_00000008 3: 00000000_11F8B1E0
4: 00000000_00000004 5: 00000000_0000000F
6: 00000000_123BAAEA 7: 00000000_123BAAEE
8: 00000000_1200D730 9: 00000000_0000000C
A: 00000000_11F8C176 B: 00000000_11F8A5C0
C: 00000000_122B2020 D: 00000000_12267128
E: 00000000_7FFFFFFF F: 00000017_0000000C
END OF SYMPTOM DUMP

SYSTEM COMPLETION CODE=0C4 REASON CODE=00000011
TIME=11.03.28 SEQ=09523 CPU=0000 ASID=0096
PSW AT TIME OF ERROR 078D1000 91F8C222 ILC 4 INTC 11
ACTIVE LOAD MODULE ADDRESS=11F00000 OFFSET=0008C222
NAME=NATBATT
DATA AT PSW 11F8C21C - A0945850 30004050 10004119

 - The executed program
DEFINE DATA LOCAL                                
1 #TABELLE              (195)                    
  2 #TABELLE-TEXT       (A12)                    
  2 REDEFINE #TABELLE-TEXT                       
    3 #TABP-URSPR-FOLGE  (P03)                   
    3 #TABP-WERT         (P11,2)                 
  2 REDEFINE #TABELLE-TEXT                       
    3 #TABA-URSPR-FOLGE  (P03)                   
    3 #TABA-WERT         (A10)                   
1 #I_MLD (I2)                                    
1 #I_PARM (A10/2)                                
1 #MAX-REG(P03)                                  
1 ##ST_ME (A32)                                  
END-DEFINE                                       
ASSIGN ##ST_ME = 'ALPHANUM-AUF'            
      
CALLNAT 'WTABH0N'                                
  ##ST_ME #MAX-REG #TABELLE(*) #I_MLD #I_PARM(*) 
END       

The called Subprogram WTABH0N:

DEFINE DATA                             
PARAMETER                               
1 #METHODE (A32)                        
1 #MAX-TAB (P03)                        
1 #TABELLE              (1 : V)         
  2 #TABELLE-TEXT       (A12)           
   2 REDEFINE #TABELLE-TEXT             
     3 #TABP-URSPR-FOLGE  (P03)         
     3 #TABP-WERT         (P11,2)       
   2 REDEFINE #TABELLE-TEXT             
     3 #TABA-URSPR-FOLGE  (P03)         
     3 #TABA-WERT         (A10)         
1 #I_MLD   (I02)                        
1 #I_PARM  (A10/2)                      
LOCAL
...                                   

We are using NAT-Ver 4.2.4 on Mainframe.

Best guess, without seeing the rest of your subprogram, is that somehow you are attempting to place some data in one of the “subscripted” variables (#TAPB-URSPR-FOLGE, etc) and you have an illegal (incorrect) subscript.

When you use the 1:V notation it is up to the programmer to guarantee that you do not go “out of bounds”. The old way to do this was to pass the number of occurrences as a parameter to the subprogram. The new way to do this is, for example, to use the system variable *OCC (#TABELLE-TEXT).

steve

Hi Steve,

thanks for your answer.

Maybe i should add some parts of the code:


DEFINE DATA    /*    WTABH0N                          
PARAMETER                                
1 #METHODE (A32)                        
1 #MAX-TAB (P03)                        
1 #TABELLE              (1 : V)          
  2 #TABELLE-TEXT       (A12)            
   2 REDEFINE #TABELLE-TEXT              
     3 #TABP-URSPR-FOLGE  (P03)          
     3 #TABP-WERT         (P11,2)        
   2 REDEFINE #TABELLE-TEXT              
     3 #TABA-URSPR-FOLGE  (P03)          
     3 #TABA-WERT         (A10)          
1 #I_MLD   (I02)                        
1 #I_PARM  (A10/2) 
END-DEFINE                                                
WRITE *OCC (#TABELLE-TEXT )                     
WRITE 'IN' *PROGRAM                             
RESET #I_MLD                                    
IF #MAX-TAB = 0                                 
   ASSIGN #MAX-TAB = #MAX                       
END-IF                                          
  REPEAT                                        
  IF #METHODE = 'ALPHANUM-AUF'                                                     
 RESET #TABA-URSPR-FOLGE(*)       /* <--------------------!!!    
*   ....           
     ESCAPE BOTTOM
  END-IF     
...     
  ASSIGN #I_MLD = 1010             
  ESCAPE BOTTOM                    
  END-REPEAT                       
END                                

I reduced the code again, but now i found out the “error-line” as marked above. By replacing “*” with some kind of *OCC-variables the problem should be “shooted”.

I didn’t even consider this type of mistake you mentioned, because the result of the WRITE-statements were not printed. That’s why I thougt the problem has to be in connection to the parameter-interface.

Thanks again and have a nice weekend.

One more brief observation.

From your code, it looks like you will be getting one of two “types” of data.

2 REDEFINE #TABELLE-TEXT
3 #TABP-URSPR-FOLGE (P03)
3 #TABP-WERT (P11,2)
2 REDEFINE #TABELLE-TEXT
3 #TABA-URSPR-FOLGE (P03)
3 #TABA-WERT (A10)

It looks like you use #METHODE to distinguish the two types.

You might want to consider using the OPTIONAL facility.

You could have something like:

1 #TAB-URSPR-FOLGE (P03/1:V)
1 #TABP-WERT (P11,2/1:V) optional
1 #TABA-WERT (A10/1:V) optional

in your subprogram. Then you could have

IF #TABP-WERT (1) SPECIFIED

to distinguish which type of data you have.

In your programs you would have two commas for either #TABP-WERT or #TABA-WERT to indicate these variables were not being “specified”.
#TAB-URSPR-FOLGE would be the same, since it is always P3.

Just a suggestion. This is no more efficient than the code you have. I tend to think this code is easier to read, but that is a subjective view.

steve