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
 

 

How to pass information in quotes thorugh COBOL statement.

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

New User


Joined: 11 May 2005
Posts: 26
Location: Hyderabad

PostPosted: Mon May 15, 2006 7:19 pm    Post subject: How to pass information in quotes thorugh COBOL statement.
Reply with quote

Hi,

I want to write in a report file a heading which should be in quotes. For instance i need to write 'REPORT FOR PAYROLL SYSTEM'

When i declare in thw working storage section :
I put WS-HEADER PIC X(25) VALUE 'REPORT FOR PAYROLL SYSTEM'

But the result comes as REPORT FOR PAYROLL SYSTEM without quotes. Please let me know how can i achieve the desired results.
Back to top
View user's profile Send private message

hariavinash

New User


Joined: 04 Jan 2006
Posts: 64

PostPosted: Mon May 15, 2006 8:41 pm    Post subject:
Reply with quote

try putting "'REPORT FOR PAYROLL SYSTEM' " i.e double quotes.
if this did not work
use this

MOVE X'7D'

with the same values u have defined to override with single quotes whereever you wanted.

cheers
Back to top
View user's profile Send private message
shrivatsa
Warnings : 1

Active User


Joined: 17 Mar 2006
Posts: 171
Location: Bangalore

PostPosted: Mon May 15, 2006 10:11 pm    Post subject:
Reply with quote

***************************** Top of Data ***********************
IDENTIFICATION DIVISION.
PROGRAM-ID. COB1.
ENVIRONMENT DIVISION.
*************************
* THIS PROGRAM CAN BE USED AS A TEMPLATE.
*************************
DATA DIVISION.
WORKING-STORAGE SECTION.
01 WS-COUNT PIC X(30) VALUE "'REPORT FOR PAYROLL SYSTEM'".
PROCEDURE DIVISION.
MAIN-PARA.
DISPLAY WS-COUNT.
STOP RUN.


Outer is the double quote and inside is the single quote

Output

'REPORT FOR PAYROLL SYSTEM'
Back to top
View user's profile Send private message
DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Mon May 15, 2006 10:19 pm    Post subject: Re: How to pass information in quotes thorugh COBOL statemen
Reply with quote

Avinash_Gupta,

It appears as though your compiler is running with APOST option on.

Try WS-HEADER PIC X(25) VALUE '''REPORT FOR PAYROLL SYSTEM'''.

This is three single quote ( apostrophe ).

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

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Tue May 16, 2006 5:52 am    Post subject:
Reply with quote

Hi Avinash,

The 2 things to keep in mind:
1) You code 2 quotes for every quote you want to see displayed.
2) The entire literal must begin with 1 quote and end with one quote.

Here's the best example:

Suppose you wanted to display ''. That is, just 2 single quotes. How would you code the literal?
Code:


05  TWO-QUOTES       PIC  X(002) VALUE ''''''.


DISPLAY TWO-QUOTES

or

DISPLAY ''''''   


Both will display ''

Of course, the 2nd DISPLAY will not require the variable TWO-QUOTES.

I haven't tested, but it should work. If anybody has the time, give it a try and let us know the resuts.
Back to top
View user's profile Send private message
twissi

Active User


Joined: 01 Aug 2005
Posts: 105
Location: Somerset, NJ

PostPosted: Tue May 16, 2006 1:02 pm    Post subject:
Reply with quote

Hi Avinash,

If none of the above solutions work, please use this!

Declare the varible as

Code:
01 WS-HEADER.
     10  FILLER                PIC X VALUE QUOTE.
     10  WS-HEADER-VAL         PIC X(25) VALUE 'REPORT FOR PAYROLL SYSTEM'.
     10  FILLER                PIC X VALUE QUOTE.

Please let me know how it goes by.

Cheers, Twissi.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Thu May 18, 2006 4:33 am    Post subject:
Reply with quote

Playing off of Shri's suggestion, if your compiler is set to use single quotes to contain a literal, you can use double quotes to print:
Code:


"REPORT FOR PAYROLL SYSTEM"

with VALUE '"REPORT FOR PAYROLL SYSTEM"'


If it uses double quotes, do just the opposite to print:
Code:


'REPORT FOR PAYROLL SYSTEM'

with VALUE "'REPORT FOR PAYROLL SYSTEM'" 
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 Executing OO COBOL program invoking J... Virendra Shambharkar COBOL Programming 2 Tue Jan 10, 2017 6:37 pm
No new posts OO COBOL compile error Virendra Shambharkar COBOL Programming 3 Tue Jan 10, 2017 6:05 pm
No new posts Need Suggestion on COBOL program vickey_dw COBOL Programming 5 Thu Jan 05, 2017 10:55 pm
No new posts JES2 JEC: Use UNIX Pipes to Pass Data... Virendra Shambharkar JCL & VSAM 21 Tue Dec 20, 2016 6:55 pm
No new posts -913/-911 Deadlock during UPDATE stat... NoSleep319 DB2 5 Fri Nov 18, 2016 12:37 am


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