On the Assembler Courses where KMS-IT Limited has provided the lecturer, many of the participants are already experienced in Cobol, and are being tasked to support core business systems written in Assembler.

A quick overview of analogies between Cobol and Assembler may be of some help.

Assembler does not have the Cobol structure of:

 

IDENTIFICATION DIVISION.

 
 

ENVIRONMENT DIVISION.

 
 

DATA DIVISION.

 
 

PROCEDURE DIVISION.

 

Whilst with care, data items can be mixed with instructions in Assembler, it is more common to have the bulk of the instructions (Procedure Division equivalent) preceding the data constants (Data Division equivalent). This is largely a precaution to minimise the risk of S0Cx abends through the system trying to execute data, rather than instructions.

The principal difference between Cobol and Assembler from a coding perspective is that as a high level language, Cobol deals with all the addressability issues, and the programmer does not have to worry about what registers are being used for what purpose. In Assembler it is the programmers responsibility to establish valid addressability, to track register usage, and ensure the integrity of register contents.

The potentially analogous aspects of the two languages are included below, it is not an exhaustive list, but hopefully offers some insight into how to apply Assembler to situation.

COBOL

FUNCTION

ASSEMBLER

LINKAGE SECTION and PROCEDURE DIVISION USING

Access the PARM Field

Register 1 points there on entry.

88 data type

Assign labels to arguments.

EQU instructions.

IF/THEN/ELSE

Compare a character string under 257 bytes.

CLC and BC instructions.

IF/THEN/ELSE

Compare a character string over 256 bytes.

CLCL and BC instructions.

IF/THEN/ELSE

Compare packed fields.

CP and BC instructions.

Add COMP to a PICTURE clause

Define a binary item.

Depends on the size of the field
DS H equates to
PIC S9(4) COMP

PIC X or PIC X(n)

Define a character item.

DC C'value'

Simply code the value in quotes.

Define a literal.

Code as for a DC, but precede the value with an equals sign.

Add COMP-3 to PICTURE clause

Define a packed number.

DC P'value'

PROGRAM-ID

Module Name

Name field on CSECT or START statement.

MOVE instruction

Move an item

MVC or MVCL instruction.

PERFORM n TIMES

Multiple iterations of code.

Use BCT or BCTR instruction.

REDEFINES clause

Overlay a storage area.

DSECT with USING statements.

PIC clause formatting characters, i.e. Z

Printing packed fields

Use EDIT patterns, with ED or EDMK instructions.

FILLER clause

Reserve storage without a value.

DS with or without a name field.

End of topic

Copyright © KMS-IT Limited 2002