What is the easiest way to create and write a CSV file? Is it necessary to use Excel?
What is the easiest way to create and write a CSV file? Is it necessary to use Excel?
Introducing an Excel library call would add a level of complexity that is not needed in this instance. I will typically use a line sequential file and string all the fields together into a record.
In this example, I have CNS-FIELD-DELIMITER as a constant equal to a "|" character.
SELECT CSN-FLAT-FILE
ASSIGN TO RANDOM "/sort/CSNInvFile"
ORGANIZATION IS LINE SEQUENTIAL
ACCESS MODE IS SEQUENTIAL
FILE STATUS IS FILE-STATUS.
FD CSN-FLAT-FILE
RECORD IS VARYING IN SIZE
FROM 1 TO 300 CHARACTERS.
01 CSN-FLAT-FILE-RECORD.
03 CFF-LINE PIC X(300).
78 CNS-FIELD-DELIMITER VALUE "|".
INITIALIZE CFF-LINE.
STRING
CNS-SUPPLIER-ID DELIMITED BY SIZE,
CNS-FIELD-DELIMITER DELIMITED BY SIZE,
WF-PROD-NUM DELIMITED BY " ",
CNS-FIELD-DELIMITER DELIMITED BY SIZE,
WF-AVAIL-ALPHA DELIMITED BY " ",
CNS-FIELD-DELIMITER DELIMITED BY SIZE,
WF-BO-QTY-ALPHA DELIMITED BY " ",
CNS-FIELD-DELIMITER DELIMITED BY SIZE,
WF-PO-QTY-ALPHA DELIMITED BY " ",
CNS-FIELD-DELIMITER DELIMITED BY SIZE,
WF-CONV-DATE DELIMITED BY " ",
CNS-FIELD-DELIMITER DELIMITED BY SIZE,
WF-DISCONTINUED-SW DELIMITED BY SIZE,
CNS-FIELD-DELIMITER DELIMITED BY SIZE,
WF-DESCRIPTION DELIMITED BY SIZE
INTO
CFF-LINE
END-STRING.
What is the easiest way to create and write a CSV file? Is it necessary to use Excel?
What is the easiest way to create and write a CSV file? Is it necessary to use Excel?
What is the easiest way to create and write a CSV file? Is it necessary to use Excel?
What is the easiest way to create and write a CSV file? Is it necessary to use Excel?
C$JUSTIFY and then use INSPECT [field name] REPLACING TRAILING SPACES BY "_". Then you can delimit by "_".
What is the easiest way to create and write a CSV file? Is it necessary to use Excel?
What is the easiest way to create and write a CSV file? Is it necessary to use Excel?
What is the easiest way to create and write a CSV file? Is it necessary to use Excel?
What is the easiest way to create and write a CSV file? Is it necessary to use Excel?
What is the easiest way to create and write a CSV file? Is it necessary to use Excel?
What is the easiest way to create and write a CSV file? Is it necessary to use Excel?
What is the easiest way to create and write a CSV file? Is it necessary to use Excel?
What is the easiest way to create and write a CSV file? Is it necessary to use Excel?
What is the easiest way to create and write a CSV file? Is it necessary to use Excel?
Sign up
Already have an account? Login
Welcome to the Rocket Forum!
Please log in or register:
Employee Login | Registration Member Login | RegistrationEnter your E-mail address. We'll send you an e-mail with instructions to reset your password.