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
 
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: 8344
Location: Dubuque, Iowa, 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: 2504
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 Removing spaces before the tab character V S Amarendra Reddy SYNCSORT 1 Thu Jun 14, 2018 8:45 am
No new posts Splitting one row into multiple Rows ... Rajan Moorthy DFSORT/ICETOOL 9 Mon May 14, 2018 10:58 pm
No new posts Invalid XML character while producing... nikhil.bhole IBM Tools 4 Tue Mar 20, 2018 1:24 am
No new posts Moving a COMP-3 Variable to a Numeric... ajayachander COBOL Programming 2 Thu Dec 14, 2017 5:46 pm
No new posts Move from Comp3 variable to Edited Va... Revathy.nair0485 COBOL Programming 7 Fri Nov 03, 2017 3:30 pm

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