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
 

 

Initializing Variables.

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

New User


Joined: 16 Oct 2006
Posts: 80
Location: chennai

PostPosted: Mon Mar 23, 2009 7:06 pm    Post subject: Initializing Variables.
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: 7936
Location: Bellevue, IA

PostPosted: Mon Mar 23, 2009 7:17 pm    Post subject:
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    Post subject:
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: 80
Location: chennai

PostPosted: Mon Mar 23, 2009 7:31 pm    Post subject:
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: 80
Location: chennai

PostPosted: Mon Mar 23, 2009 7:33 pm    Post subject:
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: 7936
Location: Bellevue, IA

PostPosted: Mon Mar 23, 2009 7:43 pm    Post subject:
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: 80
Location: chennai

PostPosted: Mon Mar 23, 2009 7:51 pm    Post subject:
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: 7936
Location: Bellevue, IA

PostPosted: Mon Mar 23, 2009 7:57 pm    Post subject:
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: 80
Location: chennai

PostPosted: Mon Mar 23, 2009 8:06 pm    Post subject:
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: 7936
Location: Bellevue, IA

PostPosted: Mon Mar 23, 2009 8:18 pm    Post subject:
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    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 Protection Exception while move 0 to ... Kevin Vaz CICS 10 Tue Oct 18, 2016 4:19 pm
No new posts Is it possible to pass variables of s... Csongor CLIST & REXX 2 Fri Jun 10, 2016 7:33 pm
No new posts TWS 'global' or 'local' variables Steve Coalbran IBM Tools 2 Thu Mar 17, 2016 7:40 pm
No new posts Using different values for Skeleton d... venksiv CLIST & REXX 8 Thu Sep 03, 2015 5:28 pm
No new posts Types of variables REXX tvinodkumar7 TSO/ISPF 2 Wed Aug 26, 2015 6:57 pm


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