HP3000-L Archives

March 2007, 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:
"Schleicher, Randy (Windsor, CT)" <[log in to unmask]>
Reply To:
Schleicher, Randy (Windsor, CT)
Date:
Wed, 7 Mar 2007 13:29:33 -0500
Content-Type:
text/plain
Parts/Attachments:
text/plain (96 lines)
Here's how I have created CSV files in QUIZ.  It's a bit brute force
with numeric fields since we're still on 7.28, but it gets the job done.
I use the TRUNC function to eliminate trailing spaces.

ACC HAZ-XREF 
DEF SFD-ACCT CHAR*8 = GETS("SFD_ACCT")
DEF DLQ CHAR*1 = '"'
DEF DLC CHAR*1 = ','
DEF DLXX CHAR*3 = '","'
DEF DLXN CHAR*2 = '",'
DEF DLNX CHAR*2 = ',"'
DEF DISCONT-DATEX CHAR*10 = ASCII(DISCONT-DATE)[5:2] + "/" + &
    ASCII(DISCONT-DATE)[7:2] + "/" + &
    ASCII(DISCONT-DATE)[1:4] IF DISCONT-DATE > 0 ELSE " "
DEF DIF-CTRX CHAR*10 = ASCII(DIF-CTR)
DEF QTY-SLDYTDX CHAR*12 = ASCII(QTY-SLDYTD) &
    IF QTY-SLDYTD > 0 ELSE "000"
DEF QTY-SLDYTDX2 CHAR*12 = &
    QTY-SLDYTDX[1:INDEX(QTY-SLDYTDX," ") - 3] + "." + &
    QTY-SLDYTDX[INDEX(QTY-SLDYTDX," ") - 2:2]
DEF QTY-SLDLYX CHAR*12 = ASCII(QTY-SLDLY) &
    IF QTY-SLDLY > 0 ELSE "000"
DEF QTY-SLDLYX2 CHAR*12 = &
    QTY-SLDLYX[1:INDEX(QTY-SLDLYX," ") - 3] + "." + &
    QTY-SLDLYX[INDEX(QTY-SLDLYX," ") - 2:2]
DEF QTYX CHAR*12 = ASCII(QTY) &
    IF QTY > 0 ELSE "000"
DEF QTYX2 CHAR*12 = &
    QTYX[1:INDEX(QTYX," ") - 3] + "." + &
    QTYX[INDEX(QTYX," ") - 2:2]
DEF DESCR92 CHAR*92 = PACK(DESCR + " " + DESCR2 + " " + DESCR3)
DEF REC1 CHAR*900 = DLQ + "SFD-ACCT" + DLXX + &
    "S-ITEM" + DLXX + "HAZ-CODE" + DLXX + &
    "DESCRIPTION" + DLXX + "MIF-LOGICAL-DEL" + DLXX + &
    "DISCONT-DATE" + DLXX + "REPLACED-WITH" + DLXX + &
    "CIF-ACTIVE-INACTIVE" + DLXX + "#-ACTIVE-DIFS" + DLXX + &
    "UNIT-STOCK" + DLXX + "QTY-ONHAND" + DLXX + &
    "QTY-SLDYTD" + DLXX + "QTY-SLDLY" + DLQ
DEF REC2 CHAR*900 = DLQ + TRUNC(SFD-ACCT) + DLXX + &
    TRUNC(S-ITEM) + DLXX + TRUNC(HAZ-CODE) + DLXX + &
    TRUNC(DESCR92) + DLXX + TRUNC(MIF-LOGICAL-DEL) + DLXN + &
    TRUNC(DISCONT-DATEX) + DLNX + TRUNC(REPLACED-WITH) + DLXX + &
    ACTIVE-STATUS[1:1] + DLXN + TRUNC(DIF-CTRX) + DLNX + &
    TRUNC(UNIT-STOCK) + DLXN + TRUNC(QTYX2) + DLC + &
    TRUNC(QTY-SLDYTDX2) + DLC + TRUNC(QTY-SLDLYX2)
SET SUB NAME HAZITEMS KEEP APPEND SIZ 900000
@IF FIRSTIME
REP SUM REC1
SET REP LIM 1
SET NOWARN
GO
@ENDIF
SORT ON S-ITEM
REP SUM REC2
SET REP LIM 900000
SET WARN
GO
EXIT

-----Original Message-----
From: HP-3000 Systems Discussion [mailto:[log in to unmask]] On
Behalf Of kellie Jones
Sent: Wednesday, March 07, 2007 12:53 PM
To: [log in to unmask]
Subject: [HP3000-L] Create a CSV file

I've read the archives - and the only info I can find on CSV files is
converting 
to fixed from a csv file.

I was wondering if there was a way to create a *real* csv file on the
3000.

I don't have many resources - I can create a csv file with COBOL or with

QUIZ. What they really are is a fixed length file with commas in between
the 
fields. Problem is, if you open the file up in excel - there are extra
spaces, and 
it doesn't handle it correctly (you can see the data fine - but if you
need to 
load it into a database or do a lookup - it includes the trailing
spaces). I'd 
have to do a trim in excel and re-save the file to get rid of the
spaces.

Is there a way to do this in COBOL or even just from the OS? 

tia

* To join/leave the list, search archives, change list settings, *
* etc., please visit 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 *

ATOM RSS1 RSS2