× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I see that the attached picture - which should demonstarte the usage - was
not delivered into mailing list -so here in the text

mikl1071@MIKL1071 ~/awk/COBOL_copybook
$ cat FOOBAR.cbl
* Example
* COBOL Copy Book
*
01 FOOBAR-AREA.
* Characters
05 FOO PIC X(24).

05 BAR PIC XXX.
05 FOOBAR PIC 99.

* Numbers
FOO BAR BAZ
05 SPAM PIC S9(16) COMP-3.

05 EGGS PIC S9(04)V9(2).
05 SPAM-AND-EGGS PIC S9(07)V999 COMP-3.

mikl1071@MIKL1071 ~/awk/COBOL_copybook
$ awk -f cbl2sql.awk FOOBAR.cbl
create table FOOBAR_AREA (
FOO CHAR(24)
BAR CHAR(3)
FOOBAR DEC(2,0)
SPAM DEC(16,0)
EGGS DEC(6,2)
SPAM-AND-EGGS DEC(10,3)
)
Done.

I have this awk version on my PC:

mikl1071@MIKL1071 ~/awk/COBOL_copybook
$ awk --version
GNU Awk 3.1.7
Copyright (C) 1989, 1991-2009 Free Software Foundation.


On the iSeries I have this older version and it doen't run with it


QSH Command Entry


GNU Awk 3.0.3
Copyright (C) 1989, 1991-1997 Free Software Foundation.

This program is free software; you can redistribute it and/or modify

it under the terms of the GNU General Public License as published by

the Free Software Foundation; either version 2 of the License, or

(at your option) any later version.

This program is distributed in the hope that it will be useful,

but WITHOUT ANY WARRANTY; without even the implied warranty of

MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

GNU General Public License for more details.

You should have received a copy of the GNU General Public License

along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA.
/home/ROMANAPS $

===>



F3=Exit F6=Print F9=Retrieve F12=Disconnect
F13=Clear F17=Top F18=Bottom F21=CL command entry




From:
RMiklos@xxxxxx
To:
"COBOL Programming on the IBM i \(AS/400 and iSeries\)"
<cobol400-l@xxxxxxxxxxxx>, Dan <dan27649@xxxxxxxxx>
Date:
02.06.2016 14:55
Subject:
Re: [COBOL400-L] Convert COBOL record layout specs to PF or DDL specs?
Sent by:
"COBOL400-L" <cobol400-l-bounces@xxxxxxxxxxxx>



Hi,

I have only a little home brew utility - better said an awk script (see
https://en.wikipedia.org/wiki/AWK)
which translates a very simple Copy Book Structure (without REDEFINES) a
creates the corresponding SQL Create Statement
We use in tables which are processed by COBOL basically only CHAR and
DECIMAL fields.

For example if we have an copy book like this

* Example
* COBOL Copy Book
*
01 FOOBAR-AREA.
* Characters
05 FOO PIC X(24).

05 BAR PIC XXX.
05 FOOBAR PIC 99.

* Numbers
FOO BAR BAZ
05 SPAM PIC S9(16) COMP-3.

05 EGGS PIC S9(04)V9(2).
05 SPAM-AND-EGGS PIC S9(07)V999 COMP-3.

then the script converts it into

create table FOOBAR_AREA (
FOO CHAR(24)
BAR CHAR(3)
FOOBAR DEC(2,0)
SPAM DEC(16,0)
EGGS DEC(6,2)
SPAM-AND-EGGS DEC(10,3)
)

Unfortunatelly it doesn't run on iSeries, but on the PC, because on the
iSeries I don't have the current awk version, only an old one.

If you are interested I can send you the source. Maybe you can use it as
is , or enhance it for your needs, or only for inspiration, how to
programm the better utility self :-)

The processing looks like this - see the picture




Regards

Roman




From:
Dan <dan27649@xxxxxxxxx>
To:
cobol400-l@xxxxxxxxxxxx
Date:
31.05.2016 20:10
Subject:
[COBOL400-L] Convert COBOL record layout specs to PF or DDL specs?
Sent by:
"COBOL400-L" <cobol400-l-bounces@xxxxxxxxxxxx>



We have a client who supplied us with COBOL record layout specs for a
rather large layout, and I was wondering if anyone has possession of or
has
seen a utility that will convert such specs into SQL DDL or PF specs
before
I go and invent that wheel.

- Dan

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.