View previous topic :: View next topic
|
Author |
Message |
Avinash_Gupta
New User
Joined: 11 May 2005 Posts: 26 Location: Hyderabad
|
|
|
|
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 |
|
|
hariavinash
New User
Joined: 04 Jan 2006 Posts: 64
|
|
|
|
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 |
|
|
shrivatsa Warnings : 1 Active User
Joined: 17 Mar 2006 Posts: 174 Location: Bangalore
|
|
|
|
***************************** 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 |
|
|
DavidatK
Active Member
Joined: 22 Nov 2005 Posts: 700 Location: Troy, Michigan USA
|
|
|
|
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 |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
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 |
|
|
twissi
Active User
Joined: 01 Aug 2005 Posts: 105 Location: Somerset, NJ
|
|
|
|
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 |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
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 |
|
|
|