简体   繁体   中英

mainframe copybook with redefines clause to load data in oracle external table

I have redefines clause in a copybook that I have to load into oracle external table using the file sent over. Below is the copybook information. Incoming file is in positional format Should I assume in the data record in file, first 8 characters is for alphanumeric, and next 8 characters is for numeric. I just need to know if I should account for 16 characters total for this, because there are other fields in the copybook before and after this field.

eg

ENROLLMENT-DT PIC X(08). ENROLLMENT-DT-N REDEFINES ENROLLMENT-DT PIC 9(08

Allow 8 bytes in total for the 2 fields. For this example, redefines signifies the 2 fields occupy the same position in the record. The copybook lets you look at the field as either a String field or a Text field

Another example of redefines is

 03  Birth-Date         pic 9(8).
 03  redefines Birth-Date.
     05 Birth-year      pic 9(4)
     05 Birth-Month     pic 99.
     05 Birth-Day       pic 99.

This allows you to access date in both YYYYMMDD format + the individual Year/Month/Day fields

 Move 20180612          to Birth-Date

then

 Birth-year = 2018
 Birth-Month = 06
 Birth-Day = 12

Similarly if you do

 Move 2020         to Birth-year
 Move 02           to Birth-Month 
 Move 21           to Birth-Day

then Birth-Date=20200221


If the file is coming from an IBM Mainframe , the RecordEditor can display the position/length of a Cobol Copybook fields

In RecordEditor option Utilities >>> Display Cobol Copybook a Cobol copybook is displayed like:

Cobol 抄写本

finally the cb2xml will convert a Mainframe Cobol copybook to xml (with the position and lengths in the Xml).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM