11.1.1.5 Example(s)
- The following example converts normal copybook file
abc_orig.cbl
to view fileabc_orig.v
:cpy2view32 /home/abc_orig.cbl
- The following example converts exceptional copybook file abc.cbl to view file
abc.v:
cpy2view32 -e /home/abc.cbl
- The following example converts normal copybook file
abc_orig.cbl
and outputs to view filexyz.v
:cpy2view32 -o xyz.v /home/abc_orig.cbl
- The following listings through provide Copybook and view file output Example(s):
Listing Copybook Example 1
#########################
01 BOOK-INFO.
05 BOOK-ID PIC 9(9) COMP-5.
05 BOOK-NAME PIC X(100).
05 PUBLISHER PIC X(100).
05 PRICE USAGE COMP-1.
#########################
Listing VIEW32 Output Example 1
#########################
#type cname fbname count flag size null
VIEW book_info
unsignedint book_id - 1 - - -
string book_name - 1 - 100 -
string publisher - 1 - 100 -
float price - 1 - - -
END
#########################
Listing Copybook Example 2
#########################
01 COMPUTER.
05 COMPUTER-ID PIC 9(9) COMP-5.
05 COMPUTER-NAME PIC X(20).
05 PRODUCER PIC X(40).
05 FILLER PIC X(4).
05 SELL-PRICE USAGE COMP-2.
05 RENTAL-PRICE PIC S9999V999 PACKED-DECIMAL.
05 KEYBOARD-PRICE PIC S9(4) SIGN IS LEADING SEPARATE.
05 MOUSE-PRICE PIC S9(4) SIGN IS LEADING.
05 FILLER PIC X(4).
* define other computer components below
05 CPU.
10 MODEL PIC X(20).
10 PRODUCER PIC X(40).
10 PRICE USAGE COMP-1.
05 COMPUTER-MEMORY OCCURS 4 TIMES.
10 MODEL PIC X(20).
10 PRODUCER PIC X(40).
10 PRICE USAGE COMP-1.
05 MAINBOARD.
10 MODEL PIC X(20).
10 PRODUCER PIC X(40).
10 PRICE USAGE COMP-1.
05 MONITOR.
10 MODEL PIC X(20).
10 PRODUCER PIC X(40).
10 PRICE USAGE COMP-1.
05 HARDDISK.
10 MODEL PIC X(20).
10 PRODUCER PIC X(40).
10 PRICE USAGE COMP-1.
#########################
Listing VIEW32 Output Example 2
#########################
#type cname fbname count flag size null
VIEW cpu
string model - 1 - 20 -
string producer - 1 - 40 -
float price - 1 - - -
END
VIEW computer_memory
string model - 1 - 20 -
string producer - 1 - 40 -
float price - 1 - - -
END
VIEW mainboard
string model - 1 - 20 -
string producer - 1 - 40 -
float price - 1 - - -
END
VIEW monitor
string model - 1 - 20 -
string producer - 1 - 40 -
float price - 1 - - -
END
VIEW harddisk
string model - 1 - 20 -
string producer - 1 - 40 -
float price - 1 - - -
END
VIEW computer
unsignedint computer_id - 1 - - -
string computer_name - 1 - 20 -
string producer - 1 - 40 -
string filler1 - 1 - 4 -
double sell_price - 1 - - -
carray rental_price - 1 - 4 -
string keyboard_price - 1 - 5 -
string mouse_price - 1 - 4 -
string filler2 - 1 - 4 -
struct cpu cpu 1 - - -
struct computer_memory computer_memory 4 - - -
struct mainboard mainboard 1 - - -
struct monitor monitor 1 - - -
struct harddisk harddisk 1 - - -
END
#########################
Parent topic: cpy2view32(1)