When making updates to Don Higgins' z390 assembler for its implementation of
the HLASM C2A built'in function, I noticed a possible inconsistency between
actual HLASM behavior and what is documented in the "HLASM Language Reference
V1R6" manual. The documentation for C2A states
"The result of C2A is the same as is obtained from
&value SETA C'charstring'
except that C2A give a zero result for null strings, and does not pair
apostrophes or ampersands before conversion."
Assembling the following on a mainframe does verify all of the above statement
except C2A does appear to pair apostrophes. A snippet of HLASM SYSPRINT is also
shown below. The source lines with "???" illustrate the C2A pairing of
apostrophes. (The two source lines beginning with "** ASM..." were added from a
previous assembly.)
Sorry for the alignment. Is there a way to force a fixed font for the source
and SYSPRINT?
Am I misunderstanding the Language Reference documentation? I did a quick scan
of the HLASM options but did not see anything that would allow C2A to pair
apostrophes.
***** Begin sample source *****
TC2A CSECT
LCLA &A
LCLC &SA
&A SETA C2A('''''') pairs apostrophes; shouldn't ???
&SA SETC SIGNED(&A)
DC F'&SA'
&A SETA C2A('''''''''') pairs apostrophes; shouldn't ???
&SA SETC SIGNED(&A)
DC F'&SA'
&A SETA C2A('&&&&') does not pair ampersands; okay
&SA SETC SIGNED(&A)
DC F'&SA'
&A SETA C2A('&&&&&&&&') generates error; okay
** ASMA214E Invalid operand value - OPENC/&&&&&&&&
&SA SETC SIGNED(&A)
DC F'&SA'
***********************************************************************
&A SETA C'' generates error; okay
** ASMA037E Illegal self-defining value - C''
&SA SETC SIGNED(&A)
DC F'&SA'
&A SETA C'''''''''' pairs apostrophes; okay
&SA SETC SIGNED(&A)
DC F'&SA'
&A SETA C'&&&&&&&&' pairs ampersands; okay
&SA SETC SIGNED(&A)
DC F'&SA'
END
***** End sample source *****
***** Begin HLASM SYSPRINT snippet *****
000000 00000 0001C 1 TC2A CSECT
2 LCLA &A
3 LCLC &SA
4 &A SETA C2A('''''') pairs apo
5 &SA SETC SIGNED(&A)
6 DC F'&SA'
000000 00007D7D + DC F'32125'
7 &A SETA C2A('''''''''') pairs apo
8 &SA SETC SIGNED(&A)
9 DC F'&SA'
000004 7D7D7D7D + DC F'2105376125'
10 &A SETA C2A('&&&&')
does not
11 &SA SETC SIGNED(&A)
12 DC F'&SA'
000008 50505050 + DC F'1347440720'
13 &A SETA
C2A('&&&&&&&&') generates
** ASMA214E Invalid operand value - OPENC/&&&&&&&&
14 ** ASMA214E Invalid operand value - OPEN
15 &SA SETC SIGNED(&A)
16 DC F'&SA'
00000C 00000000 + DC F'0'
17 ****************************************
18 &A SETA C''
** ASMA037E Illegal self-defining value - C''
19 &SA SETC SIGNED(&A)
20 DC F'&SA'
000010 00000000 + DC F'0'
21 &A SETA C'''''''''' pairs apo
22 &SA SETC SIGNED(&A)
23 DC F'&SA'
000014 7D7D7D7D + DC F'2105376125'
24 &A SETA
C'&&&&&&&&' pairs amp
25 &SA SETC SIGNED(&A)
26 DC F'&SA'
000018 50505050 + DC F'1347440720'
27 END
***** End HLASM SYSPRINT snippet *****
Thanks for any help/information.