View previous topic :: View next topic |
Author |
Message |
vinush2000 Beginner
Joined: 17 Jun 2005 Posts: 15 Topics: 5
|
Posted: Thu Nov 03, 2005 9:04 am Post subject: for a change ! |
|
|
I am posting a question with the answer; wonder how many have ever done this in this forum.
I found this intresting enough to share with the forum,
How do you print a string 'Hai' (including the quote) in a file using COBOL. the answer is to use
05 FILLER X(01) VALUE ''''.
this prints a single quote.
so, for 'Hai'
05 FILLER X(01) VALUE ''''.
05 FILLER X(03) VALUE 'HAI'.
05 FILLER X(01) VALUE ''''. |
|
Back to top |
|
|
vinush2000 Beginner
Joined: 17 Jun 2005 Posts: 15 Topics: 5
|
Posted: Thu Nov 03, 2005 9:07 am Post subject: |
|
|
Hi all,
I wish everyone can post some intresting 'Find' with solution.
regards,
vinu |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12372 Topics: 75 Location: San Jose
|
Posted: Thu Nov 03, 2005 9:21 am Post subject: |
|
|
vinush,
Is this a trick question? Isn't it this simple?
Code: |
01 WS-FILLER PIC X(05) VALUE "'HAI'".
|
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
vinush2000 Beginner
Joined: 17 Jun 2005 Posts: 15 Topics: 5
|
Posted: Thu Nov 03, 2005 9:24 am Post subject: my compiler didn't accept that |
|
|
hi,
my compiler didn't accept that. does yours' accept?
regards,
vinu |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12372 Topics: 75 Location: San Jose
|
Posted: Thu Nov 03, 2005 9:28 am Post subject: |
|
|
vinush2000,
I don't have any problem with the syntax. what is your compiler? VS COBOL- II?
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
Bithead Advanced
Joined: 03 Jan 2003 Posts: 550 Topics: 23 Location: Michigan, USA
|
Posted: Thu Nov 03, 2005 9:44 am Post subject: |
|
|
I believe that it is dependant on the APOST compile option. Our shop uses single quotes to delimit values. In this case, you can substitute VALUE QUOTE for VALUE ''''. |
|
Back to top |
|
|
shekar123 Advanced
Joined: 22 Jul 2005 Posts: 528 Topics: 90 Location: Bangalore India
|
Posted: Thu Nov 03, 2005 9:53 am Post subject: |
|
|
Kolusu,
I also tried out and it is as easy as
Code: |
01 HAI PIC X(5) VALUE "'HAI'".
|
In u post u mentioned that vinush2000 's compiler might be VS COBOL II.
In my case when i see compiler listing ,i see at the top of compile listing
Code: |
IBM COBOL for OS/390 & VM 2.1.1
|
If visnush compiler is VS COBOL II ,then i guess the compile listing would be below.Please correct me and i have a query which might be silly too.I have the knowledge that we have three types of COBOL VS COBOL II,IBM COBOL and ENTERPRISE COBOL,can u please tell me which one is the latest one and widely used and is there any link which mentions about the differences in the types of COBOLS we have in present ?
_________________ Shekar
Grow Technically |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12372 Topics: 75 Location: San Jose
|
|
Back to top |
|
|
|
|