Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
How to print a string having sinngle quote(') in it.

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

New User


Joined: 30 Jul 2005
Posts: 1

PostPosted: Wed Aug 03, 2005 12:52 am    Post subject: How to print a string having sinngle quote(') in it.
Reply with quote

If I want to print a string like " sandy's home" in PL/I what will be the syntax? Please write down the code.
Back to top
View user's profile Send private message

hsourabh

New User


Joined: 24 May 2005
Posts: 12
Location: Z?rich

PostPosted: Fri Sep 09, 2005 3:31 pm    Post subject:
Reply with quote

Hi pkd,
This code's surely gonna work, try it out


FUN:PROC OPTIONS(MAIN);
DCL QUOTE CHAR(12) INIT('');
QUOTE = 'SANDY'!!'7D'X!!'S HOME';
PUT SKIP LIST(QUOTE);
END FUN;


Thanks,
Sourabh
Back to top
View user's profile Send private message
pravin madoori

New User


Joined: 29 Jan 2007
Posts: 25
Location: Hyderabad

PostPosted: Tue Aug 04, 2009 10:24 pm    Post subject: can i use '7D'X to check/verify ' in a string
Reply with quote

I tried below code:

select(character1)
when ('&') do; ......end;
when ('"') do;......end;
when(" ' ") do ;....end;;<==== this is not working.. how can i check if my character1 is a single quote[ " ' "]. Can i use 7D'X in when?
Back to top
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1060
Location: Oostende, Belgium

PostPosted: Wed Aug 05, 2009 12:24 am    Post subject: Re: can i use '7D'X to check/verify ' in a string
Reply with quote

pravin madoori wrote:
I tried below code:

select(character1)
when ('&') do; ......end;
when ('"') do;......end;
when(" ' ") do ;....end;;<==== this is not working.. how can i check if my character1 is a single quote[ " ' "]. Can i use 7D'X in when?


A single quote is just that, not what you use, which is a a three-character sequence of a space, a single quote and another space.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8165
Location: East Dubuque, Illinois, USA

PostPosted: Wed Aug 05, 2009 12:46 am    Post subject:
Reply with quote

The Enterprise PL/I Language Reference (manuals link at the top of the page) states:
Quote:
3.1.3 Using quotation marks

String constants, hexadecimal constants, and the picture-specification are enclosed in either single or double quotation marks.

The following rules apply to quotation marks within a string:

* If the included quotation marks are the same type as those used to enclose the string, you must enter two quotation marks (that is, '' or "") for each occurrence to be included.
so your code needs to be
Code:
when('''') do ;....end;
i.e., a single tic mark to start the string, two single tic marks to denote the single quote mark, and a single tic mark to end the string. I believe (but cannot prove) that this should work as well:
Code:
when("'") do ;....end;
where the spaces you included in your posted string have been removed.
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
No new posts line 52: Name or string > 250 char... Ashishpanpaliya CLIST & REXX 5 Sat Oct 14, 2017 2:29 am
No new posts Search for a string in many PDS KARTHIGADEVI CLIST & REXX 5 Fri Sep 08, 2017 2:32 pm
No new posts How to change a string containing the... chong.zhou TSO/ISPF 6 Tue Aug 29, 2017 4:54 pm
No new posts String after '.' (period) is not copy... balaji81_k SYNCSORT 6 Wed Aug 23, 2017 9:35 pm
No new posts change string before sertan string anatol DFSORT/ICETOOL 8 Tue Aug 15, 2017 5:43 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us