TAL Programmer's Guide

Copying Data Into Arrays
Using Arrays
7–18 096254 Tandem Computers Incorporated
The compiler does a standard move and returns a 16-bit next address if:
Both arrays have standard byte addresses
Both arrays have standard word addresses
The compiler does an extended move and returns a 32-bit next address if:
One of the two arrays has a standard byte address and the other has a standard
word address
Either array has an extended address
STRING arrays and arrays pointed to by STRING pointers are byte addressed. All
other arrays are word addressed.
Copying Bytes Into INT Arrays
To copy data from a byte-addressed source array into a word-addressed destination
array, declare an extended STRING simple pointer and use it in the next-address
clause of the move statement:
STRING byte_array[0:9]; !Byte-addressed source array
INT word_array[0:4]; !Word-addressed destination
! array
STRING .EXT next_addr; !STRING simple pointer for
! the next-address clause
!Some code here
word_array[0] ':=' byte-array[0] FOR 3 BYTES -> @next_addr;
!Copy three bytes into
! WORD_ARRAY
When the copy operation is complete, the next-address pointer (NEXT_ADDR) points
to the right byte of WORD_ARRAY[1], not the left byte.
Concatenating
Copy Operations
You can concatenate any number of move sources in a single move statement by using
the ampersand operator (&).
The following move statement concatenates six move sources. It copies three string
constants and data from three arrays into LINE_ARRAY:
LITERAL line_len = 63; !Length of destination array
LITERAL date_len = 11; !Length of source array 1
LITERAL id_len = 11; !Length of source array 2
LITERAL dept_len = 3; !Length of source array 3
STRING .line_array[0:line_len - 1]; !Destination array
STRING .date_array[0:date_len - 1] := "Feb 1, 1992";
STRING .id_num[0:id_len - 1] := "854-70-1950";
STRING .dept_num[0:dept_len - 1] := "107";
line_array ':=' " DATE: " & date_array FOR date_len BYTES
& " ID NUMBER: " & id_num FOR id_len BYTES
& " DEPARTMENT: " & dept_num FOR dept_len BYTES;