Reg variable declaration

This is a Mainframe COBOL forum - you can post your queries on Mainframe COBOL, VS COBOL II, COBOL/370 , Enterprise COBOL

Moderators: dbzTHEdinosauer, Moderator Group

Post Reply
Jelin
Member
Posts: 2
Joined: Fri Jul 21, 2006 1:26 pm

Reg variable declaration

Post by Jelin » Fri Jul 21, 2006 1:38 pm

I declared one variable like this
01 WS-MESSAGE-TABLE.
05 PIC X(83) VALUE
'00 PROCESSING WAS SUCCESSFUL'.
05 PIC X(83) VALUE
'01 CRI-RATE-DATE NOT FOUND. MOST RECENT DATE AND RATE
- ' TO CONVERT THE AMOUNT'.
05 PIC X(83) VALUE
'02 FUNCTION IS "R" BUT CRI-AMOUNT <> 0. RATE WAS
- ' CRI-AMOUNT WAS SET TO 0.'.

shows error in this code.Can u plz resolve this issue

User avatar
arrbee
Active Member
Posts: 144
Joined: Fri Feb 24, 2006 11:33 am

Post by arrbee » Sat Jul 22, 2006 12:23 pm

Put your compile listing error here. Otherwise, the problem could be with the quotes you are using in the third variable. Within single quotes you are trying to have a alphabet "R" in the double quotes. I think it is not permitted that way.

HTH.
Arr Bee
-------------
?My joy in learning is partly that it enables me to teach? - Seneca(Roman philosopher, mid-1st century AD)

Jelin
Member
Posts: 2
Joined: Fri Jul 21, 2006 1:26 pm

Post by Jelin » Mon Jul 24, 2006 10:20 am

So how can i use a double quote within a single quote????

preethiraj
Member
Posts: 1
Joined: Mon Aug 28, 2006 5:48 pm
Location: Trivandrum

Post by preethiraj » Mon Aug 28, 2006 5:52 pm

Try with a pair of single quotes for each double quote

156138
Member
Posts: 15
Joined: Tue Aug 29, 2006 7:27 pm
Location: Chennai

Reg: variable declaration

Post by 156138 » Fri Sep 01, 2006 1:42 pm

I don't think the double quote inside the last literal will be a cause for
u r compile error. I have tried with double quote and it is working
fine.

What might be the cause iam thinking is that if you want continue a literal
in next line there should be '-' in the indent column(7th column) and you
must start the value of literal in area B(12th column) in the next line.
I will give you a sample code that has worked for me.

01 WK-WORKING-EXAMPLE.
05 PIC X(83) VALUE 'ABCD'.
05 PIC X(83) VALUE 'ABCD "12" ABCD1233333333333333333333333
- 'ACD'.
(this continuation should start at 12th column).

Hope this might be useful for you.
Could you please let me know if something else caused the compile error.


Regards,
vinod reddy.

User avatar
arrbee
Active Member
Posts: 144
Joined: Fri Feb 24, 2006 11:33 am

Post by arrbee » Thu Sep 07, 2006 10:36 am

Hi, Try this code and let me know if this is what you are expecting !!

Code: Select all

IDENTIFICATION DIVISION.                        
PROGRAM-ID. QUOTE01.                            
ENVIRONMENT DIVISION.                           
DATA DIVISION.                                  
WORKING-STORAGE SECTION.                        
01 WS-Q1  PIC  X&#40;20&#41; VALUE "THIS ISN""T WRONG". 
PROCEDURE DIVISION.                             
MAIN-PARA.                                      
    DISPLAY ' *** START *** '.                  
    DISPLAY WS-Q1.                              
    DISPLAY ' *** END *** '.                    
    STOP RUN.                                   
The output is shown as given below:

Code: Select all

  *** START ***    
 THIS ISN"T WRONG  
  *** END ***      
Arr Bee
-------------
?My joy in learning is partly that it enables me to teach? - Seneca(Roman philosopher, mid-1st century AD)

gottabe.grenz
Member
Posts: 6
Joined: Thu Sep 14, 2006 10:41 am

Post by gottabe.grenz » Thu Sep 14, 2006 2:22 pm

HI,
you v emissed the continuation on some of the lines.. this one works perfectly..


01 WS-MESSAGE-TABLE.
05 PIC X(83) VALUE
- '00 PROCESSING WAS SUCCESSFUL'.
05 PIC X(83) VALUE
- '01 CRI-RATE-DATE NOT FOUND. MOST RECENT DATE AND RATE
- ' TO CONVERT THE AMOUNT'.
05 PIC X(83) VALUE
- '02 FUNCTION IS "R" BUT CRI-AMOUNT <> 0. RATE WAS
- ' CRI-AMOUNT WAS SET TO 0.'.

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others