Search code examples
cobol

STRING INTO multiple variables


Is there a way to use the STRING INTO with multiple variables?

For example (this works):

MOVE string TO variable1
               variable2
               variable3 

The same example with STRING INTO (this doesn't work):

STRING string DELIMITED BY SIZE INTO variable1
                                     variable2
                                     variable3 

Is there a way to put STRING INTO multiple variables? I need to move into alot of strings, so I don't like to write STRING INTO for every variable...


Solution

  • Use UNSTRING without the DELIMITED phrase, as in the example here for formatting date/time. The length of the recieving field determines the number of characters moved.