Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Which function does the Ampersand (&) have in String

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler
View previous topic :: :: View next topic  
Author Message
Andi1982

New User


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

PostPosted: Wed Aug 24, 2016 2:05 pm    Post subject: Which function does the Ampersand (&) have in String
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Wed Aug 24, 2016 2:27 pm    Post subject: Reply to: Which function does the Ampersand (&) have in String
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: 31
Location: Karlsruhe / Germany

PostPosted: Wed Aug 24, 2016 2:34 pm    Post subject:
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 User


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

PostPosted: Wed Aug 24, 2016 5:43 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm
No new posts Check System time(Minute) Using TIME1... balaji81_k DFSORT/ICETOOL 5 Fri Nov 11, 2016 10:53 am
This topic is locked: you cannot edit posts or make replies. Checking wether a string starts from ... sundaram.naveen CLIST & REXX 9 Thu Oct 06, 2016 11:56 am
No new posts Strange EXEC function call in z/VM Willy Jensen CLIST & REXX 3 Wed Oct 05, 2016 2:07 pm
No new posts Replace function abdulrafi COBOL Programming 13 Mon Sep 12, 2016 10:12 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us