IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Which function does the Ampersand (&) have in String


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Andi1982

New User


Joined: 27 Mar 2008
Posts: 42
Location: Karlsruhe / Germany

PostPosted: Wed Aug 24, 2016 2:05 pm
Reply with quote

Hey,

I already googled a lot for it but i did not find an answer to my question. We had this MVC in our program:

Code:
MVC   MEINKEY(4),=X'50505050'
MVC   MEINKEY+4(4),SAVRABG


It produced this correct Output:

Code:
MEINKEY: &&&&0084


But for some co-worker it did not look nice enough. so he made this:

Code:
MVC   MEINKEY(4),=C'&&&&'
MVC   MEINKEY+4(4),SAVRABG


and finally Output was like that:

Code:
MEINKEY: &&  0084


So a lot of things did not work anymore because of that.

I changed it back now, but I would like to understand the meaning of this ampersand sign in strings.

Somebody here who can explain me what happened?

Best regards
Andi[/code]
Back to top
View user's profile Send private message
enrico-sorichetti

Senior Moderator


Joined: 14 Mar 2007
Posts: 10712
Location: italy

PostPosted: Wed Aug 24, 2016 2:27 pm
Reply with quote

the IBM assembler manuals will tell all You might want to know about the quirks of special chars icon_cool.gif
Back to top
View user's profile Send private message
Andi1982

New User


Joined: 27 Mar 2008
Posts: 42
Location: Karlsruhe / Germany

PostPosted: Wed Aug 24, 2016 2:34 pm
Reply with quote

Hey,

thank you for your hint. I found out that it is used for variables in macros.

IBM Manual - Special characters

And if you want to have the ampersand then you have to use two. So this four ones resulted in just two. If I put '&&&&&&&&' then it results in 4.

Hope my co worker will be happy with that.

Thanks again for your hint!
Back to top
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 869
Location: The Universe

PostPosted: Wed Aug 24, 2016 5:43 pm
Reply with quote

In truth, both X'50505050' and C'&&&&&&&&' are pretty bad: X'50505050' leaves you guessing what the H is this 50?!; and &&&&&&&&, well, it's pretty obvious what the character is, but 8 & characters to produce 4 & characters is sort of weird. 4C'&&' might be a little better!

The single quote character is also strange, C'STEVE''S EXAMPLES ARE AWFUL' is sort of OK, but
Code:
MSG      DC    0CL133' ',C' I DON''T UNDERSTAND STRING '''
STRING   DC    CL8' ',CL(L'MSG-(*-MSG)''''
is a little hard to understand.

Similarly, text books always seem to use c*** like
Code:
         MVC   TOD,=X'4021207A20207A20204B2020'
         ED    TOD,TIME

TIME     DC    X'23595999'
TOD      DC    C' HH:MM:SS.SS'
That 24 character hex string is completely mysterious, but try typing it correctly! At least the TOD data area might take some of the mystery out of it.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts Need to split single line into two li... DFSORT/ICETOOL 7
No new posts DB2 - row_number function - Need 1st ... DB2 5
No new posts how to convert Hex String t char hex PL/I & Assembler 6
No new posts How to Assign a Function key to Mainf... TSO/ISPF 4
No new posts Get next 5 numeric from a string of '... COBOL Programming 4
Search our Forums:

Back to Top