# Problem with 1:V - Array

**URL:** <https://techcommunity.softwareag.com/t/problem-with-1-v-array/92735>\
**Category:** Forum\
**Tags:** Adabas-Natural, Natural, Natural-News-and-General-Topics\
**Created:** [February 12, 2010, 4:24pm UTC](https://techcommunity.softwareag.com/t/problem-with-1-v-array/92735 "2010-02-12T16:24:13Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![CRossmeissl](https://avatars.discourse-cdn.com/v4/letter/c/65b543/32.png) [@CRossmeissl](https://techcommunity.softwareag.com/u/CRossmeissl)\
**Post date:** [February 12, 2010, 4:24pm UTC](https://techcommunity.softwareag.com/t/problem-with-1-v-array/92735/1 "2010-02-12T16:24:13Z")

</div>

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

```auto
 - 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:

```auto
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.

---

<div class="post-metadata">

**Author:** ![Steve\_Robinson](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/steve_robinson/32/107_2.png) [@Steve\_Robinson](https://techcommunity.softwareag.com/u/Steve_Robinson)\
**Post date:** [February 12, 2010, 5:02pm UTC](https://techcommunity.softwareag.com/t/problem-with-1-v-array/92735/2 "2010-02-12T17:02:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![CRossmeissl](https://avatars.discourse-cdn.com/v4/letter/c/65b543/32.png) [@CRossmeissl](https://techcommunity.softwareag.com/u/CRossmeissl)\
**Post date:** [February 12, 2010, 5:42pm UTC](https://techcommunity.softwareag.com/t/problem-with-1-v-array/92735/3 "2010-02-12T17:42:43Z")

</div>

Hi Steve,

thanks for your answer.

Maybe i should add some parts of the code:

```auto

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.

---

<div class="post-metadata">

**Author:** ![Steve\_Robinson](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/steve_robinson/32/107_2.png) [@Steve\_Robinson](https://techcommunity.softwareag.com/u/Steve_Robinson)\
**Post date:** [February 12, 2010, 6:09pm UTC](https://techcommunity.softwareag.com/t/problem-with-1-v-array/92735/4 "2010-02-12T18:09:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [April 2, 2021, 2:58pm UTC](https://techcommunity.softwareag.com/t/problem-with-1-v-array/92735/5 "2021-04-02T14:58:01Z")

</div>

Closed on April 2, 2021, 2:58pm UTC


