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

problem related to QUOTES


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

New User


Joined: 22 Dec 2006
Posts: 24
Location: USA

PostPosted: Tue Nov 04, 2008 1:30 am
Reply with quote

Hi,

I am trying to ALLOC a file using the following piece fo code:

my Working Storage Variable:
Code:
01  WS-SELECT-PARM-1.                                         
    05  FILLER                 PIC  X(31)   VALUE             
        'CMD(ALLOCATE  DDNAME(DMG) DS'.                   
    05  WS-FILE-NAME           PIC  X(28)   VALUE SPACES.     
    05  FILLER                 PIC  X(52)   VALUE             
        ' MOD BLKSIZE(2000) LRECL(200) DSORG(PS) RECFM(F B)'.
    05  FILLER                 PIC  X(49)   VALUE             
        ' TRACKS SPACE(15,15) RELEASE UNIT(SYSDA) CATALOG)'. 

  IF  WS-TABLE-LAST-ONE = SPACES                               
      STRING '(' QUOTE SC-USER-ID-F '.'                       
           WS-TABLE-FIRST-SEVEN '.J'                           
           ZJCHAR '.CNTL' QUOTE ')'                           
                                DELIMITED BY SIZE             
             INTO  WS-FILE-NAME  OF WS-SELECT-PARM-1           
        END-STRING       

Next i call SPF-LINK
Code:
 CALL SPF-ISPLINK  USING  SPF-SELECTZ       
                          SPF-BUFLEN         
                          WS-SELECT-PARM-1. 

here, when it tries to alloc the name of Dataset is picked up as "XYZ.TPR.J2.CNTL" and says dataset does not exist.

i believe this should be 'XYZxx.TPRxx.J2.CNTL'.

i checked my complier setting it has APOST so quotes should be converted to single quotes but it isn't happening.

Any pointers will be apperciated.

Edited: Please use BBcode when You post some code, that's rather readable...Anuj
Back to top
View user's profile Send private message
Douglas Wilder

Active User


Joined: 28 Nov 2006
Posts: 305
Location: Deerfield IL

PostPosted: Tue Nov 04, 2008 3:16 am
Reply with quote

I have not tried using APOST and QUOTE. I do not see anything wrong with what you did. But you could get around it by coding a variable with a value clause with a single quote within double quotes like the following:
Code:
05  MY-QUOTE          PIC X    VALUE "'".
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Tue Nov 04, 2008 4:18 am
Reply with quote

You drastically misunderstand the meaning of the compiler options in saying this:
Quote:
i checked my complier setting it has APOST so quotes should be converted to single quotes but it isn't happening.
There is not, under any circumstances, conversion from one to the other. As the Programming Guide says,
Quote:
___ QUOTE/APOST option syntax __________________________________________
| |
| _QUOTE_ |
| >>__|_______|_______________________________________________________>< |
| |_APOST_| |
| |
|________________________________________________________________________|

Default is: QUOTE

Abbreviations are: Q|APOST

Use QUOTE if you want the figurative constant [ALL] QUOTE or [ALL] QUOTES to represent one or more quotation mark (") characters.

Use APOST if you want the figurative constant [ALL] QUOTE or [ALL] QUOTES to represent one or more single quotation mark (') characters.

Delimiters: You can use either quotation marks or single quotation marks as literal delimiters regardless of whether the APOST or QUOTE option is in effect. The delimiter character used as the opening delimiter for a literal must be used as the closing delimiter for that literal.
You can use two apostrophes in a row, as the Language Reference clearly indicates:
Quote:
The enclosing quotation marks or apostrophes are excluded from the literal when the program is compiled.

An embedded quotation mark or apostrophe must be represented by a pair of quotation marks ("") or a pair of apostrophes (''), respectively, when it is the character used as the opening delimiter. For example,


"THIS ISN""T WRONG"
'THIS ISN''T WRONG'
Back to top
View user's profile Send private message
geet16

New User


Joined: 22 Dec 2006
Posts: 24
Location: USA

PostPosted: Tue Nov 04, 2008 4:44 am
Reply with quote

hi,

As suggested by Douglas, i was able to solve the problem. Thank You Douglas.


Robert, i am just trying to understand Quotes/apostrophes better, i found this info which i might have mis-understood and now throughly confused as well, kindly let me know any pointers where i can understand this better:

Quote:

QUOTE/QUOTES

Represents one or more occurrences of the quotation mark character and must be nonnumeric. QUOTE, or QUOTES cannot be used in place of a quotation mark or an apostrophe to enclose a nonnumeric literal.
+-------------------------------IBM Extension--------------------------------+

When APOST is specified as a compiler option, the figurative constant QUOTE has the EBCDIC value of an apostrophe.
+----------------------------End of IBM Extension----------------------------+



TIA
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Tue Nov 04, 2008 5:46 am
Reply with quote

Code:
01  WS-VAR             PIC X(01) VALUE QUOTE.
sets WS-VAR to either a tic mark (if APOST is set) or a double tic mark (if QUOTE is set). This is the primary use of the facility, since CALL 'LITERAL' can be CALL "LITERAL" and does not depend on the compiler setting (although I haven't tested that).

As the manual says, you cannot use QUOTE in place of literals in VALUE clauses -- so
Code:
VALUE QUOTEFILE.NAME.LITERALQUOTE
is not valid.
Back to top
View user's profile Send private message
geet16

New User


Joined: 22 Dec 2006
Posts: 24
Location: USA

PostPosted: Tue Nov 04, 2008 6:09 am
Reply with quote

Hi,

We have used INSPECT to calculate the length and accordingly remove the spaces. Also i have used a dummy dataset name here, sorry for the confusion.

I am not able to understand the working of QUOTES/APOST as the same program is working fine in our Production environment wherein the QUOTES are converted into Apostrophes but the same code is not working in Test enviornment.


Thanks,
Geet
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Tue Nov 04, 2008 7:42 am
Reply with quote

Does the test environment have QUOTE and the production environment APOST in the compile procedures? Quotes are not converted into anything -- they are, based on the compiler option, a single tic mark (apostrophe) or double tic marks (quotation mark). What code are you referring to when you say that quotes are converted into apostrophes?
Back to top
View user's profile Send private message
geet16

New User


Joined: 22 Dec 2006
Posts: 24
Location: USA

PostPosted: Tue Nov 04, 2008 7:55 am
Reply with quote

Hi,

using this piece of code i am trying to dynamically create a file-name which will be then allocated using ALLOC command.

Code:


  IF  WS-TABLE-LAST-ONE = SPACES                               
      STRING '(' QUOTE SC-USER-ID-F '.'                       
           WS-TABLE-FIRST-SEVEN '.J'                           
           ZJCHAR '.CNTL' QUOTE ')'                           
                                DELIMITED BY SIZE             
             INTO  WS-FILE-NAME  OF WS-SELECT-PARM-1           
        END-STRING   



For Eg: My id is ABCD12 then 'ABCD12.XYZS.J2.CNTL' file should be created and using ALLOC command should be allocated.

In my program, this string is coming out to be "ABCD12.XYZS.J2.CNTL" instead of 'ABCD12.XYZS.J2.CNTL' and hence ALLOC command fails each time when i run this uplaod program.

TIA
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Tue Nov 04, 2008 8:48 am
Reply with quote

Although I haven't had a chance to test this, it should work:
Code:
STRING '(''' SC-USER-ID-F ' '
     WS-TABLE-FIRST-SEVEN '.J'
     ZJCHAR '.CNTL'' )'


Do not depend upon the QUOTE as it may be " or ' depending on how the compiler options are set. You can override this behavior by setting the parameter yourself, but why ask for future trouble?
Back to top
View user's profile Send private message
geet16

New User


Joined: 22 Dec 2006
Posts: 24
Location: USA

PostPosted: Tue Nov 04, 2008 11:44 pm
Reply with quote

Hi Robert,

The code mentioned by you worked for me. Thank You!! icon_biggrin.gif

Thank You to all of you for all your suggestions!![/quote]
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Wed Nov 05, 2008 12:04 am
Reply with quote

Glad to hear it worked -- I didn't get a chance to test that one.
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 Map Vols and Problem Dataset All Other Mainframe Topics 2
No new posts Help in extracting data between doubl... DFSORT/ICETOOL 5
No new posts z/vm installation problem All Other Mainframe Topics 0
No new posts Job scheduling problem. JCL & VSAM 9
No new posts Problem with IFTHEN=(WHEN=GROUP,BEGIN... DFSORT/ICETOOL 5
Search our Forums:

Back to Top