I have a Metal C program where I am trying to add some static data via an 
__asm(“…” : DS(staticdata)) statement, but I am having some issues with the 
generated assembler code.

When I use my own prolog and epilog code, I get:

0007E6                00000 009A8  1997 CKKTESTR CSECT ,                        
                                 000000
0007E8                             1998 $STATIC  DS    0D                       
                                 000000
0007E8 0000000000000000            1999          DC    (336)X'00'               
                                 000000
000938                00938 00828  2000          ORG   $STATIC+64               
                                 000000
000828 0000000100000030            2001          DC    XL8'0000000100000030'    
                                 000000
000830                00830 00830  2002          ORG   $STATIC+72               
                                 000000
000830 F2F1C3E2D9C5C3D7            2003          DC    XL8'F2F1C3E2D9C5C3D7'    
                                 000000
000838                00838 007F8  2004          ORG   $STATIC+16               
                                 000000
0007F8 C5E2C54000000001            2005          DC    
XL16'C5E2C540000000010000000100000090'                    000000
000808 0000009000000020            2006          DC    
XL16'0000009000000020C5E2C3C100000001'                    000000
000818 0000000100000080            2007          DC    
XL16'00000001000000800000008000000014'                    000000
000828                00828 007E8  2008          ORG   $STATIC                  
                                 000000
0007E8 00010000                    2009          DC    XL4'00010000'            
                                 000000
0007EC                007EC 007EC  2010          ORG   $STATIC+4                
                                 000000
0007EC F2F1C3E200000000            2011          DC    
XL12'F2F1C3E2000000007FFFFBAD'                            000000
0007F8                007F8 00938  2012          ORG   ,                        
                                 000000
                                   2013          LCLC  &DSMAC                   
                                 000000
                                   2014          LCLA  &DSSIZE                  
                                 000000
                                   2015          LCLA  &MSIZE                   
                                 000000
000938                00938 00838  2016          ORG   $STATIC+80               
                                 000000
                      00838        2017 @@LAB@3  EQU   *                        
                                 000000
000838                             2018          DS    0D                      
Start copyright text on a         000000
                      00838        2019 TheESET  EQU   *                       
Address of the ESES               000000
000838 F2F1C3E2                    2020          DC    CL4'21CSESES'           
Control block eyecatcher          000000
                                   2021 *.DC.F'1'.Control block version         
                                 000000
                                   2022 *.DC.CL8'CKKTESTR'.CSECT name           
                                 000000
                                   2023 *.DC.CL8'HTES120'.FMID                  
                                 000000
                                   2024 *.DC.CL8'XXRMIDXX'.RMID                 
                                 000000
                                   2025 *.DC.CL8'21CS-TS1'.PID                  
                                 000000
                                   2026 *.DC.CL19'2020-07-04 02:25:21.816513'   
                                 000000
                                   2027 *.DC.CL5'    '.Pad with blanks          
                                 000000
                                   2028 *.DC.C'Copyright '.Copyright text       
                                 000000
                                   2029 *.DC.C'(C) Teracloud S.A. '.Copyright 
Teracloud S.A.                     000000
                                   2030 *.DC.C'1991,2001'.Insert the year(s)    
                                 000000
000840                             2031 EndCKKModId DS 0D                      
End of ESES and copyright         000000
                      00008        2032 @@LAB@3L EQU   *-@@LAB@3                
                                 000000
                                   2033 &DSMAC   SETC  '@@LAB@3'                
                                 000000
                                   2034 &DSSIZE  SETA  256                      
                                 000000
                                   2035 &MSIZE   SETA  @@LAB@3L                 
                                 000000
** ASMA032E Relocatable value or unresolved symbol found when absolute value 
required - OPENC/@@LAB@3L                 
** ASMA435I Record 944 in SSAF.METALC.C.ASM(CKKTESTR) on volume: TSO001         
                                       
                                   2036          AIF   (&DSSIZE GE 
&MSIZE).@@OK@3                                000000
                                   2037 .@@OK@3  ANOP                           
                                 000000

Record 944 is “&MSIZE   SETA  @@LAB@3L”.

When I remove my #pragmas for the prologs and epilogs of the various routines 
in the module, I get very similar code, but it assembles cleanly (I renamed the 
program for expediency):

0002AA                00000 0044A   850 CKKTESTP CSECT ,                        
                                 000000
0002B0                              851 $STATIC  DS    0D                       
                                 000000
0002B0 0000000000000000             852          DC    (336)X'00'               
                                 000000
000400                00400 002F0   853          ORG   $STATIC+64               
                                 000000
0002F0 0000000100000030             854          DC    XL8'0000000100000030'    
                                 000000
0002F8                002F8 002F8   855          ORG   $STATIC+72               
                                 000000
0002F8 F2F1C3E2D9C5C3D7             856          DC    XL8'F2F1C3E2D9C5C3D7'    
                                 000000
000300                00300 002C0   857          ORG   $STATIC+16               
                                 000000
0002C0 C5E2C54000000001             858          DC    
XL16'C5E2C540000000010000000100000090'                    000000
0002D0 0000009000000020             859          DC    
XL16'0000009000000020C5E2C3C100000001'                    000000
0002E0 0000000100000080             860          DC    
XL16'00000001000000800000008000000014'                    000000
0002F0                002F0 002B0   861          ORG   $STATIC                  
                                 000000
0002B0 00010000                     862          DC    XL4'00010000'            
                                 000000
0002B4                002B4 002B4   863          ORG   $STATIC+4                
                                 000000
0002B4 F2F1C3E200000000             864          DC    
XL12'F2F1C3E2000000007FFFFBAD'                            000000
0002C0                002C0 00400   865          ORG   ,                        
                                 000000
                                    866          LCLC  &DSMAC                   
                                 000000
                                    867          LCLA  &DSSIZE                  
                                 000000
                                    868          LCLA  &MSIZE                   
                                 000000
000400                00400 00300   869          ORG   $STATIC+80               
                                 000000
                      00300         870 @@LAB@5  EQU   *                        
                                 000000
000300                              871          DS    0D                      
Start copyright text on a         000000
                      00300         872 TheESET  EQU   *                       
Address of the ESES               000000
000300 F2F1C3E2                     873          DC    CL4'21CSESES'           
Control block eyecatcher          000000
                                    874 *.DC.F'1'.Control block version         
                                 000000
                                    875 *.DC.CL8'CKKTESTR'.CSECT name           
                                 000000
                                    876 *.DC.CL8'HTES120'.FMID                  
                                 000000
                                    877 *.DC.CL8'XXRMIDXX'.RMID                 
                                 000000
                                    878 *.DC.CL8'21CS-TS1'.PID                  
                                 000000
                                    879 *.DC.CL19'2020-07-04 02:25:21.816513'   
                                 000000
                                    880 *.DC.CL5'    '.Pad with blanks          
                                 000000
                                    881 *.DC.C'Copyright '.Copyright text       
                                 000000
                                    882 *.DC.C'(C) Teracloud S.A. '.Copyright 
Teracloud S.A.                     000000
                                    883 *.DC.C'1991,2001'.Insert the year(s)    
                                 000000
000308                              884 EndCKKModId DS 0D                      
End of ESES and copyright         000000
                      00008         885 @@LAB@5L EQU   *-@@LAB@5                
                                 000000
                                    886 &DSMAC   SETC  '@@LAB@5'                
                                 000000
                                    887 &DSSIZE  SETA  256                      
                                 000000
                                    888 &MSIZE   SETA  @@LAB@5L                 
                                 000000
                                    889          AIF   (&DSSIZE GE 
&MSIZE).@@OK@5                                000000
                                    890 .@@OK@5  ANOP                           
                                 000000 

For whatever reason, the generated DS uses @@LAB@5, but the “&MSIZE SETA 
@@LAB@5L” assembles without error here.  Odd, because @@LAB@3L in the first 
program and @@LAB@5L in the second program evaluate to the same value:

                      00008        2032 @@LAB@3L EQU   *-@@LAB@3                
                                 000000
-----------------------------------------------------------------------------------------------------------------------
                      00008         885 @@LAB@5L EQU   *-@@LAB@5                
                                 000000

When I compare the two snippets (I removed the hex offsets and sequence 
information on the right, this is what I get:

====== CKKTESTR CSECT ,                                                         
             
.OAAAA CKKTESTP CSECT ,                                                         
             
000002 $STATIC  DS    0D                                                        
             
000003          DC    (336)X'00'                                                
             
000004          ORG   $STATIC+64                                                
             
000005          DC    XL8'0000000100000030'                                     
             
000006          ORG   $STATIC+72                                                
             
000007          DC    XL8'F2F1C3E2D9C5C3D7'                                     
             
000008          ORG   $STATIC+16                                                
             
000009          DC    XL16'C5E2C540000000010000000100000090'                    
             
000010          DC    XL16'0000009000000020C5E2C3C100000001'                    
             
000011          DC    XL16'00000001000000800000008000000014'                    
             
000012          ORG   $STATIC                                                   
             
000013          DC    XL4'00010000'                                             
             
000014          ORG   $STATIC+4                                                 
             
000015          DC    XL12'F2F1C3E2000000007FFFFBAD'                            
             
000016          ORG   ,                                                         
             
000017          LCLC  &DSMAC                                                    
             
000018          LCLA  &DSSIZE                                                   
             
000019          LCLA  &MSIZE                                                    
             
000020          ORG   $STATIC+80                                                
             
====== @@LAB@3  EQU   *                                                         
             
.OAAAB @@LAB@5  EQU   *                                                         
             
000022          DS    0D                      Start copyright text on a         
             
000023 TheESET  EQU   *                       Address of the ESES               
             
000024          DC    CL4'21CSESES'           Control block eyecatcher          
             
000025 *.DC.F'1'.Control block version                                          
             
000026 *.DC.CL8'CKKTESTR'.CSECT name                                            
             
000027 *.DC.CL8'HTES120'.FMID                                                   
             
000028 *.DC.CL8'XXRMIDXX'.RMID                                                  
             
000029 *.DC.CL8'21CS-TS1'.PID                                                   
             
000030 *.DC.CL19'2020-07-04 02:25:21.816513'                                    
             
000031 *.DC.CL5'    '.Pad with blanks                                           
             
000032 *.DC.C'Copyright '.Copyright text                                        
             
000033 *.DC.C'(C) Teracloud S.A. '.Copyright Teracloud S.A.                     
             
000034 *.DC.C'1991,2001'.Insert the year(s)                                     
             
000035 EndCKKModId DS 0D                      End of ESES and copyright         
             
====== @@LAB@3L EQU   *-@@LAB@3                                                 
             
====== &DSMAC   SETC  '@@LAB@3'                                                 
             
.OAAAC @@LAB@5L EQU   *-@@LAB@5                                                 
             
.OAAAD &DSMAC   SETC  '@@LAB@5'                                                 
             
000038 &DSSIZE  SETA  256                                                       
             
====== &MSIZE   SETA  @@LAB@3L                                                  
             
======          AIF   (&DSSIZE GE &MSIZE).@@OK@3                                
             
====== .@@OK@3  ANOP                                                            
             
.OAAAE &MSIZE   SETA  @@LAB@5L                                                  
             
.OAAAF          AIF   (&DSSIZE GE &MSIZE).@@OK@5                                
             
.OAAAG .@@OK@5  ANOP                                                            
             

The snippets are exactly the same, except for the labeling difference.

Any thoughts as to what I could have done in either/both of my prologs and 
epilogs which would perturb the assembler to cause this error.

I've cross-posted this to StackOverflow, as well, if you want to see it in a 
better format:
https://stackoverflow.com/questions/62749399/z-os-metal-c-assemble-failing-only-when-i-use-my-own-prolog-epilogs

Thanks,
Scott Fagen

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to