× 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.



"In addition to this script not resolving REDEFINEs (per Roman's earlier
note in the thread), it also doesn't resolve OCCURS."

Yes you are right. As I wrote, it was originaly written as a skript for one given task,
where I had only flat data structures without REDEFINEs and OCCURS.

If you set on the beggining of the script

# CREATE TABLE statement indikator (0=false, 1 = true)

create_table = 1

then it tries to create CREATE TABLE statement, but you need to have hierarchical structure with only one level 01 element.

If you set on the beggining

create_table = 0

it tries to extracts everything, so you can have more level 01 elements in your source.

Other thing is that the scripts convert
PIC X(n)
to CHAR(n)
and all number types to DECIMAL, i.e
PIC 9(n)
to DECIMAL(n, 0)
and
PIC 9(n)V9(m)
PIC S9(n)V9(m)
PIC S9(n)V9(m) COMP-3
to DECIMAL(n, m)

We use mostly these 2 datatypes for files which are processed with COBOL (no VARCHARs, no INTEGERs.)


-----"COBOL400-L" <cobol400-l-bounces@xxxxxxxxxxxx> píše: -----
Komu: "COBOL Programming on the IBM i (AS/400 and iSeries)" <cobol400-l@xxxxxxxxxxxx>
Od: Dan
Odoslal: "COBOL400-L"
Dátum: 03.06.2016 16:54
Predmet: Re: [COBOL400-L] Convert COBOL record layout specs to PF or DDLspecs?


Thanks Roman!

For others who, like me, are qshell / awk noobs, I copied the script Roman
provided into a (Windows) text file and saved it to my IFS folder. (For
simplicity's sake, I also stored the COBOL copybook text file in the same
folder.) I opened the script in Notepad++ and saved it as a "Unix script
file (*.sh; *.bsh)", thinking that this might get rid of the CR
characters. I tried running the script in qshell as is, but kept getting
syntax errors. Google was *not* my friend for the syntax problem, but I
did find that Notepad++ can automatically convert end-of-line characters.
In Notepad++, I clicked on View / Show Symbol / Show End of Line. Here, I
could see that each line ended with CR/LF. To remove the CR, click Edit /
EOL Conversion / UNIX/OSX Format. Now the script runs like a charm.

In addition to this script not resolving REDEFINEs (per Roman's earlier
note in the thread), it also doesn't resolve OCCURS.

- Dan

As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.