Home > Coding, Mainframe > C for z/OS assembler programmers…

C for z/OS assembler programmers…

A few C Data structures mapped to assembler equivalents:

C                        asm 

int i;                   i       ds    f       uninitialized storage area
int j=0;                 j       dc    f'0'    initialized to zero 
int *name;               name    ds    a       uninitialized 'address of' storage area 
int *name1=0;            name1   dc    a(0)    'address of' initialized to zero 
int *name2=&i;           name2   dc    a(i)    'address of' i 

struct astruct {        astruct        dsect 
int a;                  a        ds    f 
int b;                  b        ds    f 
char c[10];             c        ds    cl10 
}                       @astruct equ *-astruct        length=18 

sizeof(astruct)                  dc    a(@astruct)        length of struct/dsect

union aunion {          aunion   ds    dsect 
int k;                  k        ds    f 
                                org    k 
doube l;                l        ds    d        l overlays k 
                                org    k 
char cl10;              char     ds    cl10     char overlays k and l
                                org , 
}                        @aunion equ *-union        length=10 

sizeof(aunion)                   dc    a(@aunion)   length of the union


Categories: Coding, Mainframe
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: