IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Initializing Variables.


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
rguhanath

New User


Joined: 16 Oct 2006
Posts: 81
Location: chennai

PostPosted: Mon Mar 23, 2009 7:06 pm
Reply with quote

Hi All,

I want to initialize two variables with ' (apostrophy) and " (Quotes). please let me know how we declare for these two special char.

For Ex:

01 H PIC X(1) VALUE '"'.
01 I PIC X(1) VALUE '''.
01 J PIC X(1) VALUE '*'.
01 K PIC X(1) VALUE '#'.

if i declared like above sequence, the other variables(J,K) are converted to deactivate mode. Please give a suggestion.

Thanks & Regards,
-Nath.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8697
Location: Dubuque, Iowa, USA

PostPosted: Mon Mar 23, 2009 7:17 pm
Reply with quote

Does your compiler use APOST or QUOTE option? Assuming the tic mark (APOST) option is set you could do something like
Code:
01  QUOTE-MARK PIC X(01) VALUE '"'.
01  TIC-MARK   PIC X(01) VALUE QUOTE.
01  J          PIC X(01) VALUE '*'.
01  K          PIC X(01) VALUE '#'.
.
.
.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Mar 23, 2009 7:24 pm
Reply with quote

although the portability to other mainframes (non-ibm - non ebcidc) is unavailable,
I always define 1 byte apostrophies, asterisks, quotes in hex.

e.g. ws-comma pic x(01) value x'7B'. (if 7b is a comma, if not, whatever).
Back to top
View user's profile Send private message
rguhanath

New User


Joined: 16 Oct 2006
Posts: 81
Location: chennai

PostPosted: Mon Mar 23, 2009 7:31 pm
Reply with quote

Hi Robert,

Thanks !!

My compiler is not have such type of options. its having the below options.

COMPILER OPTIONS:
ASMHLI ===>
COBOL ===> COBOL,SXREF,VERB,MIGR,VBREF,MAP
COBOLII ===> NOCMPR2,NOFLAGMIG,OFFSET,NOLIST
COB2T ===>
ASMOLD ===>

And sorry, i didn't understand about ticmark option.

Regards,
Nath.
Back to top
View user's profile Send private message
rguhanath

New User


Joined: 16 Oct 2006
Posts: 81
Location: chennai

PostPosted: Mon Mar 23, 2009 7:33 pm
Reply with quote

Hi dbzTHEdinosauer,

Thanks for your Suggestion !!

i will try with hex format and will let you know.

Regards,
Nath.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8697
Location: Dubuque, Iowa, USA

PostPosted: Mon Mar 23, 2009 7:43 pm
Reply with quote

OK, which compiler are you using? Please post information from the first page of a compile ... such as
Code:
1PP 5655-G53 IBM Enterprise COBOL for z/OS  3.4.1                         Date 0
0Invocation parameters:
 TERM,XREF,MAP,OPT,LIST,LIST,NOOFF,NOOPT
0Options in effect:
     NOADATA
     NOADV
       APOST
       ARITH(COMPAT)
     NOAWO
       BUFSIZE(12288)
     NOCICS
       CODEPAGE(1140)
     NOCOMPILE(S)
     NOCURRENCY
       DATA(31)
     NODATEPROC
       DBCS
     NODECK
     NODIAGTRUNC
     NODLL
     NODUMP
     NODYNAM
     NOEXIT
     NOEXPORTALL
       FASTSRT
       FLAG(I,I)
     NOFLAGSTD
       INTDATE(ANSI)
       LANGUAGE(EN)
       LIB
       LINECOUNT(60)
       LIST
       MAP
     NOMDECK
     NONAME
       NSYMBOL(NATIONAL)
     NONUMBER
       NUMPROC(NOPFD)
       OBJECT
     NOOFFSET
     NOOPTIMIZE
       OUTDD(SYSOUT)
       PGMNAME(COMPAT)
       RENT
       RMODE(AUTO)
     NOSEQUENCE
       SIZE(MAX)
       SOURCE
       SPACE(1)
     NOSQL
     NOSSRANGE
       TERM
     NOTEST
     NOTHREAD
       TRUNC(BIN)
       VBREF
     NOWORD
       XREF(FULL)
1PP 5655-G53 IBM Enterprise COBOL for z/OS  3.4.1                         Date 0
0      YEARWINDOW(1900)
       ZWB
Note the APOST option is set -- I know this option goes back at least to VS COBOL II and it may go back further.

If you don't understand the difference between a single and a double quote mark (a tic mark a.k.a. apostrophe versus quote mark) then your problems are much more basic and you need to start on page one of the COBOL Language Reference (link to manuals at the top of the page) and read until you do understand the difference.
Back to top
View user's profile Send private message
rguhanath

New User


Joined: 16 Oct 2006
Posts: 81
Location: chennai

PostPosted: Mon Mar 23, 2009 7:51 pm
Reply with quote

Hi Robert,

i am sorry.. seems my compiler have APOST option. plese see below

Code:


PP 5668-958 IBM VS COBOL II Release 4.0 09/15/92               
Invocation parameters:                                         
NOEXIT,LANGUAGE(EN)                                             
PROCESS(CBL) statements:                                       
 CBL NOADV,APOST,NOAWO,BUFSIZE(8192),NOCMPR2,NOCOMPILE(S)       
 CBL DATA(24),NODBCS,DECK,NODUMP,NODYNAM,NOFASTSRT,NOFDUMP     
 CBL FLAG(I,W),NOFLAGMIG,NOFLAGSAA,NOFLAGSTD,LIB,LINECOUNT(60) 
 CBL NOLIST,MAP,NONAME,NONUMBER,NUMPROC(NOPFD),NOOBJECT,OPTIMIZE
 CBL OUTDD(SYSOUT),RENT,RESIDENT,NOSEQUENCE,SIZE(MAX),SOURCE   
 CBL SPACE(1),NOSSRANGE,NOTERM,NOTEST,TRUNC(BIN),NOVBREF,NOWORD
 CBL XREF(FULL),ZWB,LIST                                       
Options in effect:                                             
    NOADV                                                       
      APOST                                                     
    NOAWO                                                       
      BUFSIZE(8192)                                             
    NOCMPR2                                                     
    NOCOMPILE(S)                                               
      DATA(24)       
    NODBCS           
      DECK           
    NODUMP           
    NODYNAM         
    NOEXIT           
    NOFASTSRT       
    NOFDUMP         
      FLAG(I,W)     
    NOFLAGMIG       
    NOFLAGSAA       
    NOFLAGSTD       
      LANGUAGE(EN)   
      LIB           
      LINECOUNT(60) 
      LIST           
      MAP           
    NONAME           
   NONUMBER       
     NUMPROC(NOPFD)
   NOOBJECT       
   NOOFFSET       
     OPTIMIZE     
     OUTDD(SYSOUT)
     RENT         
     RESIDENT     
   NOSEQUENCE     
     SIZE(MAX)     
     SOURCE       
     SPACE(1)     
   NOSSRANGE       
   NOTERM         
   NOTEST         
     TRUNC(BIN)   
   NOVBREF         
   NOWORD         
    XREF(FULL)                                       
    ZWB                                               
 5668-958 IBM VS COBOL II Release 4.0 09/15/92       
LineID  PL SL  ----+-*A-1-B--+----2----+----3----+----
000001         000100 IDENTIFICATION DIVISION.       



REgards,
Nath.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8697
Location: Dubuque, Iowa, USA

PostPosted: Mon Mar 23, 2009 7:57 pm
Reply with quote

Yep -- so you can either use the X notation, or VALUE QUOTE for a single quote mark. Or you can use standard IBM notation and say
Code:
PIC X(01) VALUE ''''.
since double quotes inside quotes are replaced by single quotes.
Back to top
View user's profile Send private message
rguhanath

New User


Joined: 16 Oct 2006
Posts: 81
Location: chennai

PostPosted: Mon Mar 23, 2009 8:06 pm
Reply with quote

Many Thanks Robert !!!


Its working fine.

Thanks dbzTHEdinosauer !!


Regards,
Nath.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8697
Location: Dubuque, Iowa, USA

PostPosted: Mon Mar 23, 2009 8:18 pm
Reply with quote

Glad to hear it's working.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts JCL with variables JCL & VSAM 1
No new posts JCL Variables JCL & VSAM 1
No new posts reset/clear ALL application profile v... TSO/ISPF 3
No new posts REXX - Adding variables CLIST & REXX 8
No new posts using based or defined variables PL/I & Assembler 2
Search our Forums:

Back to Top