Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Sample COBOL Copybook and Data Files for Testing

6,870 views
Skip to first unread message

paulsali...@gmail.com

unread,
Jan 24, 2013, 3:44:54 PM1/24/13
to
Hi,

I'm looking for some sample or public COBOL copybook and associated data files so that I can test some code for converting COBOL data types. I've googled far and wide and can't find anything. Any help would be greatly appreciated.

Thanks.

docd...@panix.com

unread,
Jan 24, 2013, 9:48:44 PM1/24/13
to
In article <113fd937-d339-4b1e...@googlegroups.com>,
<paulsali...@gmail.com> wrote:
>Hi,
>
>I'm looking for some sample or public COBOL copybook and associated data
>files so that I can test some code for converting COBOL data types.

What platform? What compiler? What source/target relationship? What
volume?

DD

Alain Reymond

unread,
Jan 25, 2013, 2:12:25 AM1/25/13
to
Hello,
Have a look at the cobol user group, cobug.
You will probably find here what you are looking for :
http://www.cobug.com/cobug/docs/cobol_copy0139.html

Regards,
AR


Le 24/01/2013 21:44, paulsali...@gmail.com a �crit :

Graham Hobbs

unread,
Jan 25, 2013, 7:55:33 AM1/25/13
to
On Thu, 24 Jan 2013 12:44:54 -0800 (PST), paulsali...@gmail.com
wrote:

>Hi,
>
>I'm looking for some sample or public COBOL copybook and associated data files so that I can test some code for converting COBOL data types. I've googled far and wide and can't find anything. Any help would be greatly appreciated.
>
>Thanks.
---
Bits from here you may be able to use ..
EXEC SQL DECLARE ALLTYP1 TABLE
"ABIGINT" BIGINT not null,
"ABLOB" BLOB(40) NOT LOGGED NOT COMPACT ,
"ACHAR" CHAR(10) NOT NULL,
"ACLOB" CLOB(41) NOT LOGGED NOT COMPACT ,
"ADATE" DATE ,
"ADECIMAL" DECIMAL(3,1) ,
"ADOUBLE" DOUBLE ,
"AINTEGER" INTEGER ,
"ALONGVARCHAR" LONG VARCHAR,
"AREAL" REAL ,
"ASMALLINT" SMALLINT ,
"ATIME" TIME ,
"ATIMESTAMP" TIMESTAMP ,
"AVARCHAR" VARCHAR(10) )
END-EXEC.

01 ALLTYP1.
05 ABIGINT PIC S9(18) COMP-5.
05 ABLOB USAGE IS SQL TYPE IS BLOB(40).
05 ACHAR PIC X(10).
05 ACLOB USAGE IS SQL TYPE IS CLOB(41).
05 ADATE PIC X(10).
05 ADECIMAL PIC S9(2)V9(1) COMP-3.
05 ADOUBLE USAGE IS COMP-2.
05 AINTEGER PIC S9(9) COMP-5.
05 ALONGVARCHAR.
49 LEN PIC S9(4) COMP-5.
49 DAT PIC X(00087).
05 AREAL USAGE IS COMP-1.
05 ASMALLINT PIC S9(4) COMP-5.
05 ATIME PIC X(8).
05 ATIMESTAMP PIC X(26).
05 AVARCHAR.
49 LEN1 PIC S9(4) COMP-5.
49 DAT1 PIC X(10).
..
CONNECT RESET;
CONNECT TO WCB3;
DROP TABLE ALLTYP1;
CREATE TABLE ALLTYP1 (
ABIGINT BIGINT NOT NULL,
ACHAR CHAR(10) NOT NULL,
ADATE DATE,
ADECIMAL DECIMAL(3,1),
ADOUBLE DOUBLE,
AINTEGER INTEGER,
AREAL REAL,
ASMALLINT SMALLINT,
ATIME TIME,
ATIMESTAMP TIMESTAMP,
PRIMARY KEY (
ABIGINT
)
);
INSERT INTO ALLTYP1 (
ABIGINT,
ACHAR,
ADATE,
ADECIMAL,
ADOUBLE,
AINTEGER,
AREAL,
ASMALLINT,
ATIME,
ATIMESTAMP
)
VALUES(
01.00,
'BCDEFGHIJK',
CURRENT DATE,
94.4,
000010107,
1000157,
1000307,
10155,
CURRENT TIME,
CURRENT TIMESTAMP
);
INSERT INTO ALLTYP1 (
ABIGINT,
ACHAR,
ADATE,
ADECIMAL,
ADOUBLE,
AINTEGER,
AREAL,
ASMALLINT,
ATIME,
ATIMESTAMP
)
VALUES(
60.00,
'KLMNOPQRST',
CURRENT DATE,
81.1,
000016125,
1017857,
1018007,
19005,
CURRENT TIME,
CURRENT TIMESTAMP
);
CONNECT RESET;
..
the INSERT's don't create all the datatypes. For one of my apps I
generate sixty test rows; for posting here there's only two and
doesn't include all the datatypes and no, I don't have a flat file.
Graham Hobbs
---

mrs.m...@gmail.com

unread,
Feb 1, 2013, 1:14:31 PM2/1/13
to
Hi all, thanks for the responses, and sorry for not following up sooner. In retrospect, I was more concerned with data types and how they are stored. The file was incidental.

The cobug user group was a great resource and very helpful.

Thanks again.

mkp...@gmail.com

unread,
Jul 18, 2013, 3:09:07 AM7/18/13
to
Hi,
I am new ti this group. I want to use copy book in my program, could you please tell me where i need to specify the copy lib for this?
and v hav one more option like 'copy bookname of lib', some one tel me sample program for this

Pete Dashwood

unread,
Jul 19, 2013, 12:10:51 AM7/19/13
to
As most users of this forum are not psychic and cannot read minds, you might
need to tell us what compiler you are using, and what documentation you have
available for it.

Most COBOL compilers have at least one manual that fully details the use of
COPY and how to set up COPY libs.

Many PC based COBOL compilers come with a directory full of sample programs,
which may also contain at least one using COPY.

If you have trouble understanding the manuals/code samples then we can
possibly help you, but you must specify more details. (Compiler, version,
sample of your coding attempt, etc.)

Pete.

--
"I used to write COBOL...now I can do anything."


jasim...@gmail.com

unread,
Jul 23, 2013, 12:29:47 PM7/23/13
to


Hi pete,

can you help me understand a little more about cobol. i want to know what are infile and outfile and also some basics of cobol

i am windows user and using microsoft visual studio to practice some cobol programs.

Alistair Maclean

unread,
Jul 23, 2013, 3:08:41 PM7/23/13
to
I am going to be quite cruel here but it is for your own good:

If you do not know what an infile and an outfile are then your understanding of basic computer fundamentals (tortology?) is such that you would not understand the answer. Please buy a copy of "Teach Yourself COBOL in 21 Days" and read from cover to cover.

Alternatively, read through the fundamental tutorial pages of any DIY UNIX (GOOGLE: UNIX; FOR THE ANSWER ( does a colon and a semicolon in one sentence constitute a record?)) and see how they refer to infile and outfile. NOTE - Unix people assume certain rules which do not necessarily pertain to the version of COBOL that you (or anyone else) may run.

Pete Dashwood

unread,
Jul 23, 2013, 9:34:40 PM7/23/13
to
Like most people here, I am very happy to help, but you need to understand
what I already said.

1. Tell us WHAT COBOL you are using. (That can change the advice you are
given significantly).

2. Try and make a SPECIFIC statement as to what exactly you are stuggling
with, so we can address that.

"I want to know basics of COBOL..." (This is a GENERAL statement , not a
SPECIFC one...)

It is a high-level, English-like computer programming language. It is
comprised of a hierarchic structure of DIVISIONS > SECTIONS > PARAGRAPHS >
STATEMENTS. The statements enable you to define and manipulate data. COBOL
source code gets compiled (by a COBOL Compiler) into instructions that are
meaningful to the underlying hardware.

(The above is a GENERAL answer, not a SPECIFIC one...)

"I want to know what infile and outfile are... "

This is a little more SPECIFIC, so I can answer a little more
specifically...:

"infile" and "outfile" are unknown to the COBOL language.

In General:

Had you posted a sample of the code (as mentioned in my previous response)
we could see the context and then give a better answer to your question. If
you had done some "homework" on COBOL instead of expecting us to spoon-feed
answers to you, you would realize the difference between a user-defined name
and a COBOL reserved word.

My advice:

Get a book on COBOL programming and work through it. (SAM's COBOL in 24
hours, by Thane Hubbell is a very good one...)

This will give you the basic understanding you wanted. When you have that,
please post any SPECIFIC problems you have, along with a statement of which
compiler and environment you are using, and a sample of the problem code and
I am sure you will receive help from this forum.

Pete Dashwood

unread,
Jul 23, 2013, 9:38:02 PM7/23/13
to
Good advice and pretty much what I told him before reading your response.

You might want to check the difference between "tortology" and
"tautology"... :-)

The "Law of Tort" is a really good soporific for insomniacs...

Alistair Maclean

unread,
Jul 24, 2013, 10:51:41 AM7/24/13
to
On Wednesday, 24 July 2013 02:38:02 UTC+1, Pete Dashwood wrote:
>
>
> You might want to check the difference between "tortology" and
> "tautology"... :-)
>

I thought that I had got the spelling wrong but lefargy and aparthey took hold.

>
>
> The "Law of Tort" is a really good soporific for insomniacs...
>
>

I have always found watching cricket to be a good cure for insomnia.

docd...@panix.com

unread,
Jul 24, 2013, 11:15:50 AM7/24/13
to
In article <b58pfr...@mid.individual.net>,
Pete Dashwood <dash...@removethis.enternet.co.nz> wrote:
>Alistair Maclean wrote:
>> On Tuesday, 23 July 2013 17:29:47 UTC+1, jasim...@gmail.com wrote:
>>> Hi pete,
>>> can you help me understand a little more about cobol. i want to know
>>> what are infile and outfile and also some basics of cobol i am
>>> windows user and using microsoft visual studio to practice some
>>> cobol programs.
>>
>> I am going to be quite cruel here but it is for your own good:
>>
>> If you do not know what an infile and an outfile are then your
>> understanding of basic computer fundamentals (tortology?) is such
>> that you would not understand the answer.

[snip]

>You might want to check the difference between "tortology" and
>"tautology"... :-)
>
>The "Law of Tort" is a really good soporific for insomniacs...

The torturous twistings of the 'Law of Tort' might readily lead one into
a Black Forest of just desserts.

(see Schwarzwaldtorte - a joke explained is a joke lost)

DD

Pete Dashwood

unread,
Jul 24, 2013, 12:09:47 PM7/24/13
to
It's a little contrived, Doc... I have never heard Black Forest Gateau
referred to as Schwarzwaldtorte; it was always Schwarzwaldkuchen in
NordRhein Westfalia, where I lived. Still, there may be regional differences
and it was a gallant attempt that made me smile... :-)

(I don't think Schwarzwaldtorte is "wrong", and the meaning would be
immediately obvious; it's just that I never heard it...)

Pete Dashwood

unread,
Jul 24, 2013, 12:11:21 PM7/24/13
to
It is when New Zealand are playing... :-)

Fred Mobach

unread,
Jul 25, 2013, 12:50:30 PM7/25/13
to
Pete Dashwood wrote:

> docd...@panix.com wrote:
>> In article <b58pfr...@mid.individual.net>,
>> Pete Dashwood <dash...@removethis.enternet.co.nz> wrote:
>>
>>> You might want to check the difference between "tortology" and
>>> "tautology"... :-)
>>>
>>> The "Law of Tort" is a really good soporific for insomniacs...
>>
>> The torturous twistings of the 'Law of Tort' might readily lead one
>> into a Black Forest of just desserts.
>>
>> (see Schwarzwaldtorte - a joke explained is a joke lost)
>>
>> DD
>
> It's a little contrived, Doc... I have never heard Black Forest Gateau
> referred to as Schwarzwaldtorte; it was always Schwarzwaldkuchen in
> NordRhein Westfalia, where I lived. Still, there may be regional
> differences and it was a gallant attempt that made me smile... :-)

In German it's known, however is doesn't stem from Germany,
http://de.wikipedia.org/wiki/Schwarzw%C3%A4lder_Kirschtorte point to a
swiss origin of the term Schwarzwaldtorte.

OT: as in many other countries there are many different German dialects,
some of which are nearly incomprehensible for those of us not used to
these dialects.
--
Fred Mobach
website : https://fred.mobach.nl
.... In God we trust ....
.. The rest we monitor ..

Pete Dashwood

unread,
Jul 25, 2013, 11:27:01 PM7/25/13
to
Thanks for clarifying, Fred.

Now I have to race out to the nearest "Cheescake Shop" franchise and get
some... :-) They do a truly wonderful rendition of it with local cheeries
and cream. It is the best I've had outside Germany.

docd...@panix.com

unread,
Jul 28, 2013, 9:46:28 AM7/28/13
to
In article <51f15758$0$295$1472...@news.sunsite.dk>,
Fred Mobach <fr...@mobach.nl> wrote:
>Pete Dashwood wrote:
>
>> docd...@panix.com wrote:

[snip]

>>> (see Schwarzwaldtorte - a joke explained is a joke lost)
>>
>> It's a little contrived, Doc... I have never heard Black Forest Gateau
>> referred to as Schwarzwaldtorte; it was always Schwarzwaldkuchen in
>> NordRhein Westfalia, where I lived. Still, there may be regional
>> differences and it was a gallant attempt that made me smile... :-)
>
>In German it's known, however is doesn't stem from Germany,
>http://de.wikipedia.org/wiki/Schwarzw%C3%A4lder_Kirschtorte point to a
>swiss origin of the term Schwarzwaldtorte.
>
>OT: as in many other countries there are many different German dialects,
>some of which are nearly incomprehensible for those of us not used to
>these dialects.

A fellow I knew went to medical school in Bern, Switzerland from 1948 to
1953; he told a wonderful story about another student's mother who came to
visit... maybe this should be discussed in a new [OT] thread someone else
will start.

DD

avr...@gmail.com

unread,
Feb 27, 2014, 8:26:05 AM2/27/14
to

Pete Dashwood

unread,
Feb 27, 2014, 4:32:59 PM2/27/14
to
As the number of datatypes known to COBOL is not huge why not knock
something up yourself?

I have systems that have to convert COBOL datatypes into C# and RDB types
and back again. It wasn't difficult to build something that converts
STRINGs, DECIMALs, DATETIMEs, FLOATs and NUMERICs between the different
systems and defining test data for it wasn't difficult either.

I have made the whole thing dynamic by generating from the COBOL FD a COBOL
profile that contains (amongst other things) the dataname and base type for
each element in XML. Types are established at runtime by accessing this XML
(in memory) using LINQ-to-XML and loading the appropriate type for whatever
is being used. (C#, COBOL, or RDBMS). This provides a "transport layer" (as
part of the overall "Data Access Layer") to get COBOL data to and from the
database, using C# code and LINQ-to-SQL. Initial tests show it is around 4
times faster than embedded SQL...

docd...@panix.com

unread,
Feb 27, 2014, 9:41:27 AM2/27/14
to

[posted and emailed]

In article <51315add-cb8a-4aaf...@googlegroups.com>,
<avr...@gmail.com> wrote:
>On Friday, January 25, 2013 2:14:54 AM UTC+5:30, paulsali...@gmail.com wrote:
>> Hi,
>>
>>
>>
>> I'm looking for some sample or public COBOL copybook and associated
>data files so that I can test some code for converting COBOL data types.

Please do your own homework.

(If you actually have 'some code for converting COBOL data types' that is
failing your tests then post it to the newsgroup so that better-aimed
suggestions might be made.)y


DD

Vince Coen

unread,
Mar 3, 2014, 12:43:24 PM3/3/14
to
Hello avr675!

Thursday February 27 2014 13:26, you wrote to All:

>> I'm looking for some sample or public COBOL copybook and associated
>> data files so that I can test some code for converting COBOL data
>> types. I've googled far and wide and can't find anything. Any help
>> would be greatly appreciated.

Look at the cobol manual for the compiler/platform that you are dealing
with.

It is NOT a large list although what you wish to convert from/to might be
useful :)



Vince


aamir...@yahoo.com

unread,
Mar 7, 2014, 11:53:26 AM3/7/14
to
Good Source of Information on Cobol Copybook!!!!!

On Friday, January 25, 2013 12:12:25 PM UTC+5, Alain Reymond wrote:
> Hello,
>
> Have a look at the cobol user group, cobug.
>
> You will probably find here what you are looking for :
>
> http://www.cobug.com/cobug/docs/cobol_copy0139.html
>
>
>
> Regards,
>
> AR
>
>
>
>
>
> Le 24/01/2013 21:44, paulsali...@gmail.com a �crit :

saiss...@gmail.com

unread,
Aug 16, 2017, 3:51:18 AM8/16/17
to

Vince Coen

unread,
Aug 16, 2017, 8:51:53 AM8/16/17
to
Hello saissen!
Converting Cobol data files from one platform to another is hardly rocket
science, just create for each file that is NOT LS a convert program that
takes original file and format, creating a new LS version with all binary
fields set up as display (e.g., pic 9(n) - where n = max. size of original
field regardless of usage of pic or binary etc). Then transfer to new
platform and use another created convert program to do the reverse.

Same applies to replacement rdbms or DMS etc systems but those are a lot
easier if you are lucky.




Vince


docd...@panix.com

unread,
Aug 16, 2017, 9:14:53 AM8/16/17
to

[posted and e-mailed]

In article <e0a46f63-d311-4f65...@googlegroups.com>,
<saiss...@gmail.com> wrote:
>On Friday, January 25, 2013 at 2:14:54 AM UTC+5:30, paulsali...@gmail.com wrote:
>> Hi,
>>
>> I'm looking for some sample or public COBOL copybook and associated
>data files so that I can test some code for converting COBOL data types.

'(S)ome sample or public COBOL copybook and associated data files... so
that I can test some code'.

Different situations may benefit from different approaches. It might help
you to post to this newsgroup some of this code you already have so a
solution appropriate to the context be generated.

(ancient canine, modern prestidigitation?)

DD

docd...@panix.com

unread,
Aug 16, 2017, 9:21:13 AM8/16/17
to
In article <15028...@f1.n250.z2.fidonet.ftn>,
Vince Coen <VBC...@gmail.com> wrote:
>Hello saissen!
>
>Wednesday August 16 2017 08:51, you wrote to All:
>
> > On Friday, January 25, 2013 at 2:14:54 AM UTC+5:30,
> > paulsali...@gmail.com wrote:
> >> Hi,
> >>
> >> I'm looking for some sample or public COBOL copybook and associated
> >> data files so that I can test some code for converting COBOL data
> >> types. I've googled far and wide and can't find anything. Any help
> >> would be greatly appreciated.
>
>Converting Cobol data files from one platform to another is hardly rocket
>science, just create for each file that is NOT LS a convert program that
>takes original file and format, creating a new LS version with all binary
>fields set up as display (e.g., pic 9(n) - where n = max. size of original
>field regardless of usage of pic or binary etc). Then transfer to new
>platform and use another created convert program to do the reverse.

Sounds like a MOVE CORR, at heart... and that's All Ya Gotta Do!

>Same applies to replacement rdbms or DMS etc systems but those are a lot
>easier if you are lucky.

I cannot speak for others... but for me - usually - 'the harder I work the
luckier I get.'

DD

Bill Gunshannon

unread,
Aug 16, 2017, 7:05:14 PM8/16/17
to
You people do realize that was a 4 year old message you were
replying to. Looks like google is once again spewing garbage.

bill

docd...@panix.com

unread,
Aug 17, 2017, 7:18:55 AM8/17/17
to
In article <evk1d7...@mid.individual.net>,
Bill Gunshannon <bill.gu...@gmail.com> wrote:
>On 8/16/2017 9:14 AM, docd...@panix.com wrote:
>> [posted and e-mailed]
>>
>> In article <e0a46f63-d311-4f65...@googlegroups.com>,
>> <saiss...@gmail.com> wrote:
>>> On Friday, January 25, 2013 at 2:14:54 AM UTC+5:30,
>paulsali...@gmail.com wrote:
>>>> Hi,
>>>>
>>>> I'm looking for some sample or public COBOL copybook and associated
>>> data files so that I can test some code for converting COBOL data types.
>>
>> '(S)ome sample or public COBOL copybook and associated data files... so
>> that I can test some code'.
>>
>> Different situations may benefit from different approaches. It might help
>> you to post to this newsgroup some of this code you already have so a
>> solution appropriate to the context be generated.
>>
>> (ancient canine, modern prestidigitation?)
>>
>
>You people do realize that was a 4 year old message you were
>replying to.

Pshaw... folks run code that hasn't been compiled in 20.

(yes, I know the difference between 'code' and 'executable modules')

Better late than never!

>Looks like google is once again spewing garbage.

Who expects different?

DD

pete dashwood

unread,
Aug 22, 2017, 12:37:22 AM8/22/17
to
Well spotted, Bill.

It's just as well really, because none of the responses understood what
he was ACTUALLY trying to do and they were about as much use as roller
skates to a steeplejack.

(Doc gets credit for spotting "all y' gotta do"... As someone who has
spent decades working with databases on different platforms and moving
between them, I can assure you, if you want it done properly, it is far
from simple. Certainly, the tools are better now than was once the case,
but there is still considerable work involved. A "one-time" solution for
this can be manufactured with hammers and long hours; a generic tool to
do it is something that is independent of the age of the dog or how
tricky it is.)

Deciding to "convert" an LS file by writing a program to convert all the
numeric fields to display is not really pertinent to someone who is
building a tool that converts COBOL data types to something else.

Understanding the statement of a problem, as always, goes a long way
towards solving it.

Pete.
--
I used to write COBOL; now I can do anything...
0 new messages