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
 

 

Specail character in the variable.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
krunalbafna
Warnings : 1

Active User


Joined: 18 Jan 2010
Posts: 143
Location: Pune

PostPosted: Fri Jul 30, 2010 7:22 pm    Post subject: Specail character in the variable.
Reply with quote

Hi Team,
01 ws-var1 pic x(07)

I want to move following value ('00aa%') to the above variable.The variable shld have Apostophe and percent '%' in the ws-var1.
May you please provide me some hint to move above variable using MOVE statement.

Regards,
KB
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


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

PostPosted: Fri Jul 30, 2010 7:35 pm    Post subject:
Reply with quote

There is a link to manuals at the top of the page, including the COBOL manuals. These manuals tell you everything you could possibly want to know about the MOVE statement -- if you read them.

Your hint is: when APOST compiler option is set, and you need an apostrophe in a literal, you must use two apostrophes and COBOL will replace them with a single apostrophe in the appropriate place.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Fri Jul 30, 2010 7:38 pm    Post subject: Reply to: Specail character in the variable.
Reply with quote

Use HEX notation -

Code:

MOVE X'7DF0F081816C7D' TO WS-VAR1.

Note: If you're using OS/VS COBOL, this won't work as HEX notation was not introduced until VS/COBOL II, the successor to OS/VS COBOL.

You should familiarize yourself with the EBCDIC collating sequence.

There is a benefit in using HEX notation in that if you open the source-member and accidentially set CAPS ON, edit a line (or several) where there are lower-case letters (such as 'aa') and then save it, the 'aa' will then become 'AA'.

This won't happen when you use HEX notation.

Bill
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sun Aug 01, 2010 4:24 am    Post subject:
Reply with quote

Hi KB,

If you want to do it the old fashioned way, the rule is:

If your literal delimiter is a quote (') and you're using quotes as part of the literal, you must code each qoute in the literal as 2 quotes ('').

So, if you want to move value '00aa%' to WS-VAR1 you "wrap" it in quotes and double each quote in the literal, i.e.: '''00aa%''' and the MOVE stmt is:

MOVE '''00aa%''' TO WS-VAR1

Another example: suppose the literal was 00a'%'
You would code '00a''%''' as the sending field in the MOVE.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Sun Aug 01, 2010 5:02 am    Post subject:
Reply with quote

Hello,

It is also possible to have a variable with the value of a quote:
Code:
01  stuff.
    05 my-quote  pic x value quote.
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 -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Writing on to GSAM variable length rohanthengal JCL & VSAM 6 Fri Mar 03, 2017 7:46 pm
No new posts the use of 'B3'x character in a panel Pedro TSO/ISPF 1 Thu Feb 16, 2017 3:09 am
No new posts Count Trailing Spaces in variable str... Virendra Shambharkar SYNCSORT 10 Thu Feb 02, 2017 12:23 pm


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