11.07.2015 Views

HLASM: V1R6 Language Ref

HLASM: V1R6 Language Ref

HLASM: V1R6 Language Ref

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

DS instructionthe data that follows is aligned on the correct boundary. For example, thefollowing statements set the location counter to the next doubleword boundaryand reserve storage space for a 128-byte field (whose first byte is on a doublewordboundary).DS0DAREA DS CL128Alignment is forced whether or not the ALIGN assembler option is set.To name fields within an areaUsing a duplication factor of zero in a DS instruction also provides a label for anarea of storage without actually reserving the area. Use DS or DC instructions toreserve storage for, and assign labels to, fields within the area. These fields canthen be addressed symbolically. (Another way of accomplishing this is described in“DSECT instruction” on page 177.) The whole area is addressable by its label. Inaddition, the symbolic label has the length attribute value of the whole area.Within the area, each field is addressable by its label.For example, assume that 80-character records are to be read into an area forprocessing and that each record has the following format:Positions 5-10 Payroll NumberPositions 11-30 Employee NamePositions 31-36 DatePositions 47-54 Gross WagesPositions 55-62 Withholding TaxThe following example shows how DS instructions might be used to assign a nameto the record area, then define the fields of the area and allocate storage for them.The first statement names the whole area by defining the symbol RDAREA; thisstatement gives RDAREA a length attribute of 80 bytes, but does not reserve anystorage. Similarly, the fifth statement names a 6-byte area by defining the symbolDATE; the three subsequent statements actually define the fields of DATE and allocatestorage for them. The second, ninth, and last statements are used for spacingpurposes and, therefore, are not named.RDAREA DS 0CL80DS CL4PAYNO DS CL6NAME DS CL20DATE DS 0CL6DAY DS CL2MONTH DS CL2YEAR DS CL2DS CL10GROSS DS CL8FEDTAX DS CL8DS CL18Additional examples of DS statements are shown below:ONE DS CL80 One 80-byte field, length attribute of 80TWO DS 80C 80 1-byte fields, length attribute of 1THREE DS 6F 6 fullwords, length attribute of 4FOUR DS D 1 doubleword, length attribute of 8FIVE DS 4H 4 halfwords, length attribute of 2SIX DS GL80 One 80-byte field, length attribute of 80SEVEN DS 80G 80 2-byte fields, length attribute of 2To define four 10-byte fields and one 100-byte field, the respective DS statementsmight be as follows:176 <strong>HLASM</strong>: <strong>V1R6</strong> <strong>Language</strong> <strong>Ref</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!