help me in creating EXCEL document as OUTPUT FROM COBOL PROG
Moderators: dbzTHEdinosauer, Moderator Group
help me in creating EXCEL document as OUTPUT FROM COBOL PROG
Hi All,
Please help me. I'm new to programming and now I'm dealing with COBOL. I want to create excel document with some named rows and columns. Please suggest me and help me to achieve this.
As I am fresher I want to know deeply on what to do ? and How to do?
Thanks
Please help me. I'm new to programming and now I'm dealing with COBOL. I want to create excel document with some named rows and columns. Please suggest me and help me to achieve this.
As I am fresher I want to know deeply on what to do ? and How to do?
Thanks
-
- Active Member
- Posts: 732
- Joined: Thu May 24, 2012 4:07 am
An EXCEL document is very complex. Not actually a suitable task for a beginner from Cobol with no additional software package to achieve it.
Your best bet is to create a simple "delimited" file which can be opened in EXCEL and will then appear as "columns".
Choose a delimiter, like | which is unlikely to appear as actual data.
Your best bet is to create a simple "delimited" file which can be opened in EXCEL and will then appear as "columns".
Choose a delimiter, like | which is unlikely to appear as actual data.
-
- Active Member
- Posts: 732
- Joined: Thu May 24, 2012 4:07 am
It is like writing a "normal" sequential file except between each actual field you have an extra field which you set to your delimiter value.
This is a very simple example, but should show you how to get data into EXCEL as a "delimited file".
Code: Select all
01 a-record.
05 a-field-no-1 PIC X(20).
05 a-delimeter-1 PIC X.
05 a-field-no-2 PIC X(12).
05 a-delimeter-1 PIC X.
05 a-field-no-3 PIC 9(9).
-
- Active Member
- Posts: 732
- Joined: Thu May 24, 2012 4:07 am
Define a sequential output file in your program.
Open it as output.
Write the delimited records to this file.
Close the file
Transfer the file to the remote where Excel is to run with a .csv extension (ftp is rather easy and the ftp client is on every PC i've seen for a long time). You will need to learn how to "pull" the file from your mainframe to the remote - ask your network people)
Open EXCEL and import the file and proceed from there.
If you want Headers for the columns in the spreadsheet, write an extra record first to the output file that contains the column-names and the pipe-delimiter.
Open it as output.
Write the delimited records to this file.
Close the file
Transfer the file to the remote where Excel is to run with a .csv extension (ftp is rather easy and the ftp client is on every PC i've seen for a long time). You will need to learn how to "pull" the file from your mainframe to the remote - ask your network people)
Open EXCEL and import the file and proceed from there.
If you want Headers for the columns in the spreadsheet, write an extra record first to the output file that contains the column-names and the pipe-delimiter.
Have a good one
-
- Moderator
- Posts: 1625
- Joined: Sat Aug 09, 2008 9:02 am
- Location: Mumbai, India
Excel is a windows (in general) software. You need to transfer the data first to a window-box from zOS -- where you create the file. As said before, while transfering the file with the choice of options you pick from -- you can name it as "file.csv"; double click on it and it will open in excel.I have tried the record structure like this. what is the logic to get data in to EXCEL?
Regards,
Anuj
Anuj
-
- Member
- Posts: 18
- Joined: Tue Apr 15, 2014 4:18 pm
Attack1988,
This topic is now over a year old so the TS is probably well past that particular program.
Why convert whatever into a CSV file - just create it as a csv file in the first place - which is wht was advised to the TS.
What command prompt?
The proper sequence is:
1 - Create CSV dataset in COBOL
2 - Transfer the dataset to the server/PC/whatever
3 - Double click (single-click in my set-up) on the file on the server/PC/whatever and it will be opened by Excel
This topic is now over a year old so the TS is probably well past that particular program.
Why convert whatever into a CSV file - just create it as a csv file in the first place - which is wht was advised to the TS.
What command prompt?
The proper sequence is:
1 - Create CSV dataset in COBOL
2 - Transfer the dataset to the server/PC/whatever
3 - Double click (single-click in my set-up) on the file on the server/PC/whatever and it will be opened by Excel
Regards
Nic
Nic
-
- Member
- Posts: 18
- Joined: Tue Apr 15, 2014 4:18 pm
-
- Member
- Posts: 18
- Joined: Tue Apr 15, 2014 4:18 pm
Creating a File in CSV using cobol ..will that not make program litttle bit complex ? I used to creat normal file .. and using JCL Squeeze option .. I generate CSV .. its kind a easy for me .. and keeps my cobol easy to read for everyone..
and also problem will happen .. say If I
have variable like X(20) .. I will occupy extra space .. right .. ?
then CSV will be having records like
NAME ,ADDRESS , NUMBER ,
but if i want like
NAME,ADDRESS,NUMBER
Squeeze Delimit in JCL will work good
and also problem will happen .. say If I
have variable like X(20) .. I will occupy extra space .. right .. ?
then CSV will be having records like
NAME ,ADDRESS , NUMBER ,
but if i want like
NAME,ADDRESS,NUMBER
Squeeze Delimit in JCL will work good
Attack1988
It does not make the cobol program any more complex as you can see from the sample code above - just a few extra fields to store the delimiter and they can be given a value at declaration. Or you can string the fields together delimited by size or space or whatever is appropriate with the delimiter between each field. That is how I do it - no extra spaces.
JCL does not have a Squeeze option - if you do not believe me look at the index of the JCL Language reference manual. If you can find it there plese give the version number of the manual, level of JCL and z/OS it refers to as I will have to download it to keep my library up to date.
JCL does not have a Squeeze option - if you do not believe me look at the index of the JCL Language reference manual. If you can find it there plese give the version number of the manual, level of JCL and z/OS it refers to as I will have to download it to keep my library up to date.
Regards
Nic
Nic
-
- Member
- Posts: 18
- Joined: Tue Apr 15, 2014 4:18 pm
FREE TUTORIALS
Tutorials
Free tutorials from mainframegurukul
- JCL Tutorial
Covers all important JCL concepts. - Cobol Tutorial
This tutorials covers all Cobol Topics from STRING to COMP-3. - DB2 Tutorial
DB2 Tutorial focuses on DB2 COBOL Programming. - SORT Tutorial
This Tutorial covers all important aspects of DFSORT with examples - CICS Tutorial
This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions
- Cobol Interview Questions
50+ Interview Questions - JCL Interview Questions
50+ Interview Questions - DB2 Interview Questions
100+ Interview Questions - CICS Interview Questions
70+ Interview Questions - VSAM Interview Questions
27 Interview Questions
Other References
Mainframe Tools and others
- XPEDITER Reference
Explains how we can debug a program - FILEAID Reference
Explains how to browse , edit and delete datasets - Change Man Reference
Quick Start tutorial on Changeman - Abend Reference
Important Abend codes explained - FaceBook Page
MainframeGurukul FaceBook Page - LinkedIn Page
MainframeGurkul Linkedin Page