HP3000-L Archives

September 2015, Week 1

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Tony Summers <[log in to unmask]>
Reply To:
Tony Summers <[log in to unmask]>
Date:
Mon, 7 Sep 2015 20:40:27 +0000
Content-Type:
text/plain
Parts/Attachments:
text/plain (1 lines)
Worth putting a final comma at the end of the line, otherwise some versions of excel can make the last column very wide.



From: Walter J. Murray [mailto:[log in to unmask]]

Sent: Monday, September 07, 2015 09:28 PM

To: [log in to unmask] <[log in to unmask]>

Subject: Re: [HP3000-L] Fun with COBOL



I'm a little late to the party, but here's my solution. Yes, the STRING

statement is helpful. I don't advocate using an apostrophe to delimit

nonnumeric literals, preferring to stick with standard COBOL. And yes,

QUOTE is a figurative constant guaranteed to give you a quotation mark.



Here's a sample program:



000100 IDENTIFICATION DIVISION.

000200 PROGRAM-ID. COBTEST.

000610 DATA DIVISION.

000620 WORKING-STORAGE SECTION.

000630 77 ONE-COMMA PIC X VALUE ",".

000640 01 1ST-ITEM PIC X(6) VALUE "ITEM 1".

000650 01 2ND-ITEM PIC X(6) VALUE "ITEM 2".

000660 01 3RD-ITEM PIC X(6) VALUE "ITEM 3".

000670 01 MY-RECORD PIC X(72).

000700 PROCEDURE DIVISION.

000800 1000-START.

000900 INITIALIZE MY-RECORD

001000 STRING QUOTE 1ST-ITEM QUOTE ONE-COMMA

001010 QUOTE 2ND-ITEM QUOTE ONE-COMMA

001011 QUOTE QUOTE ONE-COMMA

001012 QUOTE QUOTE ONE-COMMA

001013 QUOTE 3RD-ITEM QUOTE

001014 DELIMITED SIZE

001015 INTO MY-RECORD

001016 DISPLAY MY-RECORD

001020 STOP RUN.

001100 END PROGRAM COBTEST.



Here's the output:



"ITEM 1","ITEM 2","","","ITEM 3"



Walter





-----Original Message-----

From: HP-3000 Systems Discussion [mailto:[log in to unmask]] On

Behalf Of Newton, Ernie

Sent: Thursday, September 03, 2015 10:47 AM

To: [log in to unmask]

Subject: [HP3000-L] Fun with COBOL





Greetings,



It's been a long time since I wrote COBOL, and I have an elementary

question about creating a comma-delimited file.



If I want...



"item one", "item two","","","item three"



How do I create the "," between item one and item two? Is it simply PIC

"","" (quote comma quote inside double quotes?)



And the ","",""," would it be the same? Just put that inside double

quotes?



Something tells me that there is an escape sequence, but the mind is not

cooperating.



Thanks,



Ernie



________________________________



This message, including any attachments, is intended solely for the use

of the named recipient(s) and may contain confidential and/or privileged

information. Any unauthorized review, use, disclosure or distribution of

this communication(s) is expressly prohibited. If you are not the

intended recipient, please contact the sender by reply e-mail and

destroy any and all copies of the original message.



* To join/leave the list, search archives, change list settings, *

* etc., please visit http://raven.utc.edu/archives/hp3000-l.html<http://raven.utc.edu/archives/hp3000-l.html> *



* To join/leave the list, search archives, change list settings, *

* etc., please visit http://raven.utc.edu/archives/hp3000-l.html<http://raven.utc.edu/archives/hp3000-l.html> *



The contents of this email are confidential to the intended recipient and may not be disclosed. Although it is believed that this email and any attachments are virus free, it is the responsibility of the recipient to confirm this.



Details of Smith & Williamson group companies and Nexia Smith & Williamson Audit Limited and their regulators (where applicable), can be found at this URL



http://www.smith.williamson.co.uk/disclosure



* To join/leave the list, search archives, change list settings, *

* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *


ATOM RSS1 RSS2