Question

I'm transcribing some COBOL to VB.Net, but do not have access to a mainframe or COBOL compiler. In several places in the program I'm transcribing, there is a MOVE SPACES TO statement where the target is a table identifier with no index. Does this clear all records in the table, or just the 'current' record pointed to by the specified index variable?

Table declaration:

05 WS-EDI-HOLD-TABLE.                       
   10 WS-EDI-HOLD-TBL OCCURS 1000 TIMES     
                       INDEXED BY IDX1-EDI  
                                  IDX2-EDI. 
      15 WS-EDI-HOLD-DATA     PIC X(269).   

MOVE SPACES TO statement: (Appears several places)

MOVE SPACES TO WS-EDI-HOLD-TABLE
Was it helpful?

Solution

You end up setting the entire table to SPACES with:

 MOVE SPACES TO WS-EDI-HOLD-TABLE

That would be all 269000 bytes that comprize this table will now contain spaces

Any MOVE SPACES TO data-item type statement implicitly references all lower level data items as well. Beware that this type of reference assumes PICTURE X data. This can lead to real trouble when a lower level data item has an explicit PICTURE that is not compatible with 'X' type data, as is the case with COMP-3 fields for example.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top