COBOL file without copybook
Moderators: chulett, rschirm, roy
I know there will be multiple issues with the files. Another problem is I get the metadata file in .docx and I saved it as plain text with .txt file. While importing the file into DataStage, it says it does not find any 01 level.
Here is the snapshot of the first few line from the copybook:
01 CHD-BASE-SEGMENT.
05 FILLER PIC X.
05 CHD-RECORD-FORMAT PIC S9V COMP-3.
05 FILLER PIC X(10).
05 CHD-CLIENT-NUMBER PIC X(4).
05 CHD-SYSTEM-NO PIC X(4).
05 CHD-SYSTEM-NO-DETAIL REDEFINES CHD_SYSTEM_NO.
10 CHD-THOUSAND-SERIES PIC X.
10 FILLER PIC X(3).
05 CHD-PRIN-BANK PIC X(4).
05 CHD-AGENT-BANK PIC X(4).
05 CHD-ACCOUNT-NUMBER PIC X(16).
05 FILLER PIC X(5).
05 CHD-CIT-TOTL-CT PIC S9(4)V COMP-3.
Here is the snapshot of the first few line from the copybook:
01 CHD-BASE-SEGMENT.
05 FILLER PIC X.
05 CHD-RECORD-FORMAT PIC S9V COMP-3.
05 FILLER PIC X(10).
05 CHD-CLIENT-NUMBER PIC X(4).
05 CHD-SYSTEM-NO PIC X(4).
05 CHD-SYSTEM-NO-DETAIL REDEFINES CHD_SYSTEM_NO.
10 CHD-THOUSAND-SERIES PIC X.
10 FILLER PIC X(3).
05 CHD-PRIN-BANK PIC X(4).
05 CHD-AGENT-BANK PIC X(4).
05 CHD-ACCOUNT-NUMBER PIC X(16).
05 FILLER PIC X(5).
05 CHD-CIT-TOTL-CT PIC S9(4)V COMP-3.
Rumu
IT Consultant
IT Consultant
The text of your post doesn't indicate if what I'm about to say is accurate. I'm assuming it is.
The copybook format expected by the import wizard is simple. The first 7 bytes -- character positions -- must be spaces. Position 7 can contain an asterisk to make it a comment line.
The "0" of "01" must be in position 8. For ease of reading, higher numbered lines can be indented further, but that is not required.
If all of that is already true about your text file, then you have an import wizard issue.
Example, using hyphen- to indicate a space:
The copybook format expected by the import wizard is simple. The first 7 bytes -- character positions -- must be spaces. Position 7 can contain an asterisk to make it a comment line.
The "0" of "01" must be in position 8. For ease of reading, higher numbered lines can be indented further, but that is not required.
If all of that is already true about your text file, then you have an import wizard issue.
Example, using hyphen- to indicate a space:
Code: Select all
-------01 CHD-BASE-SEGMENT.
------- 05 FILLER PIC X.
------- 05 CHD-RECORD-FORMAT PIC S9V COMP-3.
------- 05 FILLER PIC X(10).
------- 05 CHD-CLIENT-NUMBER PIC X(4).
------- 05 CHD-SYSTEM-NO PIC X(4).
------- 05 CHD-SYSTEM-NO-DETAIL REDEFINES CHD_SYSTEM_NO.
------- 10 CHD-THOUSAND-SERIES PIC X.
------- 10 FILLER PIC X(3).
Franklin Evans
"Shared pain is lessened, shared joy increased. Thus do we refute entropy." -- Spider Robinson
Using mainframe data FAQ: viewtopic.php?t=143596 Using CFF FAQ: viewtopic.php?t=157872
"Shared pain is lessened, shared joy increased. Thus do we refute entropy." -- Spider Robinson
Using mainframe data FAQ: viewtopic.php?t=143596 Using CFF FAQ: viewtopic.php?t=157872
I had to look up the P in a PIC clause. It is an obscure usage meant to enhance or reduce the scale of the numeric format. The import wizard is not perfect -- see my FAQ for using mainframe data.
"999PPP" means that the 3-byte field is scaled up. A value of 123 will actually be 123,000.
Before you adjust the text to get it past the import wizard, which I'm sure is not designed to recognize that clause item, be sure you know what the intended value in the field is supposed to be. You might need to do something with it in a transformer to get it to be an accurate value.
"999PPP" means that the 3-byte field is scaled up. A value of 123 will actually be 123,000.
Before you adjust the text to get it past the import wizard, which I'm sure is not designed to recognize that clause item, be sure you know what the intended value in the field is supposed to be. You might need to do something with it in a transformer to get it to be an accurate value.
Franklin Evans
"Shared pain is lessened, shared joy increased. Thus do we refute entropy." -- Spider Robinson
Using mainframe data FAQ: viewtopic.php?t=143596 Using CFF FAQ: viewtopic.php?t=157872
"Shared pain is lessened, shared joy increased. Thus do we refute entropy." -- Spider Robinson
Using mainframe data FAQ: viewtopic.php?t=143596 Using CFF FAQ: viewtopic.php?t=157872
Hi Frank,
I checked with the mainframe guy, I have to append 00 for those fields I removed PP.
Regarding your response on starting position of the 01 Record - actually the copybook I received has 0 in the second position. Hence I changed the start position and could read it. Is it ok or do I need to ask architect to change the position of the copybook?
I checked with the mainframe guy, I have to append 00 for those fields I removed PP.
Regarding your response on starting position of the 01 Record - actually the copybook I received has 0 in the second position. Hence I changed the start position and could read it. Is it ok or do I need to ask architect to change the position of the copybook?
Rumu
IT Consultant
IT Consultant
Hi,
I received the second copybook. This copybook corresponds to a file that has multiple record types, 4 records types. Some part of each of the types are common hence it is written in below format.
Type1=Head+commonbody1+body1+commonbody2
Type2=Head+commonbody1+body2+commonbody2
Type3=Head+commonbody1+body3+commonbody2
Type4=Head+commonbody1+body4+commonbody2
The copy book has following layout:
Part of the actual copybook:
While importing the definitions, DS throws 56 errors which are mainly as below:
line 5 REDEFINES can not indentify RDT-R. etc
I found that due to line spacing, DS can only read RDT-R instead of RDT-REC-CODE-BYTES. When I removed the spaces from left and left aligned then this error gone. Am I right or there is some other reason.
I received the second copybook. This copybook corresponds to a file that has multiple record types, 4 records types. Some part of each of the types are common hence it is written in below format.
Type1=Head+commonbody1+body1+commonbody2
Type2=Head+commonbody1+body2+commonbody2
Type3=Head+commonbody1+body3+commonbody2
Type4=Head+commonbody1+body4+commonbody2
The copy book has following layout:
Code: Select all
Head
coomonboddy1
body1
body2
body3
commonbody2
Code: Select all
01 RDT-DATA.
05 RDT-HEAD.
10 RDT-REC-CODE-BYTES.
15 RDT-REC-CODE PIC X(2).
10 RDT-REC-CODE-BYTES-DETAIL REDEFINES RDT-REC-CODE-BYTES.
15 RDT-REC-CODE-KEY PIC X.
15 RDT-REC-TYPE-CONTROL PIC X.
10 RDT-NO-POST-REASON PIC S9(3)V COMP-3.
10 RDT-SC-1 PIC X.
10 RDT-SC-2 PIC X.
10 RDT-SC-3 PIC X.
10 RDT-SC-4 PIC X.
10 RDT-SC-5 PIC X.
10 RDT-SC-6 PIC X.
10 RDT-SC-7 PIC X.
10 RDT-SC-8 PIC X.
10 RDT-CHD-SYSTEM-NO PIC X(4).
10 RDT-CHD-PRIN-BANK PIC X(4).
10 RDT-CHD-AGENT-BANK PIC X(4).
10 RDT-CHD-ACCOUNT-NUMBER PIC X(16).
10 RDT-TRANSACTION-CODE PIC S9(3)V COMP-3.
10 RDT-MRCH-SYSTEM-NO PIC X(4).
10 RDT-MRCH-PRIN-BANK PIC X(4).
10 RDT-MRCH-AGENT-NO PIC X(4).
10 RDT-MRCH-ACCOUNT-NUMBER PIC X(16).
10 RDT-DR-MERCHANT-NUMBER REDEFINES RDT-MRCH-ACCOUNT-NUMBER.
10 RDT-CHD-EXT-STATUS PIC X.
10 RDT-CHD-INT-STATUS PIC X.
10 RDT-TANI PIC X.
10 RDT-TRANSFER-FLAG PIC X.
10 RDT-ITEM-ASSES-CODE-NUM PIC 9.
10 RDT-MRCH-SIC-CODE PIC S9(5)V COMP-3.
10 RDT-TRANSACTION-DATE PIC S9(7)V COMP-3.
10 RDT-DR-DATE-OF-ITEM REDEFINES RDT-TRANSACTION-DATE.
05 RDT-BODY-1.
10 RDT-BATCH-TYPE PIC S9V COMP-3.
10 RDT-JULIAN-POST-DATE PIC S9(5)V COMP-3.
10 RDT-ENTRY-TYPE PIC X.
10 RDT-ENTRY-SYS-4 PIC X(4).
10 RDT-ENTRY-SYS-2 PIC X(2).
10 RDT-ENTRY-DATE PIC X(2).
10 RDT-ENTRY-2 PIC X(2).
10 RDT-ENTRY-LAST-6 PIC X(6).
10 RDT-BKDT-ADDITIONAL-INT PIC S9(15)V99 COMP-3.
10 RDT-BACKDATED-TRAN-FLAG PIC X.
10 RDT-CBRN-TRAN-ID PIC S9(4)V COMP-3.
10 RDT-TRANSACTION-AMOUNT PIC S9(15)V99 COMP-3.
10 RDT-AUDIT-TRAIL-DATE PIC S9(7)V COMP-3.
line 5 REDEFINES can not indentify RDT-R. etc
I found that due to line spacing, DS can only read RDT-R instead of RDT-REC-CODE-BYTES. When I removed the spaces from left and left aligned then this error gone. Am I right or there is some other reason.
Rumu
IT Consultant
IT Consultant
Well... let's see. With them in there, no workie. Take them out and all better. Case closed! Your "architect" isn't going to be concerned about all the little things you need to make DataStage happy, that's on you. Clean it up and move on.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
Rumu,
Yes, what Craig said.
A bit more seriously: you are now dependent on another development environment. You need them to notify you of any changes to the code (copybooks) on which your DS jobs are dependent. You then have to manually make the corresponding changes in the jobs that use the copybooks being changed. It is not required to edit the table definition, but it is good practice to keep it in synch with your jobs that use it.
It is important to know that you control your DS environment, and if your editing of their copybook code results in accurate reads on their files, they don't need to know about it.
Just for example: Cobol has two alpha-numeric formats. PIC X is the obvious one, but PIC 9 without any other clauses is called display numeric, and stores numbers in text format. I have often needed to convert those to PIC X to help DS import them, because display numeric is an older usage with some variations that DS does not support accurately.
Each position in the first PIC is an alpha-numeric position. I then use a transformer to parse the column to what I need.
Yes, what Craig said.
A bit more seriously: you are now dependent on another development environment. You need them to notify you of any changes to the code (copybooks) on which your DS jobs are dependent. You then have to manually make the corresponding changes in the jobs that use the copybooks being changed. It is not required to edit the table definition, but it is good practice to keep it in synch with your jobs that use it.
It is important to know that you control your DS environment, and if your editing of their copybook code results in accurate reads on their files, they don't need to know about it.
Just for example: Cobol has two alpha-numeric formats. PIC X is the obvious one, but PIC 9 without any other clauses is called display numeric, and stores numbers in text format. I have often needed to convert those to PIC X to help DS import them, because display numeric is an older usage with some variations that DS does not support accurately.
Code: Select all
Original: 10 SOME-DATA PIC +99999.99
My change: 10 SOME-DATA PIC X(9)
Franklin Evans
"Shared pain is lessened, shared joy increased. Thus do we refute entropy." -- Spider Robinson
Using mainframe data FAQ: viewtopic.php?t=143596 Using CFF FAQ: viewtopic.php?t=157872
"Shared pain is lessened, shared joy increased. Thus do we refute entropy." -- Spider Robinson
Using mainframe data FAQ: viewtopic.php?t=143596 Using CFF FAQ: viewtopic.php?t=157872
I did clean up all the spaces and now getting some weired error like below:
In the below lines of copy book
It is showing error while importing metadata as 'P' Unreognized syntax.Error line number shows the line where Redefine clause is present ie the last line. Why is this error coming?
Craig, Frank
Can you please tell me is there any specified start position of 01,05 levels?
In the below lines of copy book
It is showing error while importing metadata as 'P' Unreognized syntax.Error line number shows the line where Redefine clause is present ie the last line. Why is this error coming?
Code: Select all
01 RDT-DATA.
05 RDT-HEAD.
10 RDT-MRCH-AGENT-NO PIC X(4).
10 RDT-MRCH-ACCOUNT-NUMBER PIC X(16).
10 RDT-DR-MERCHANT-NUMBER REDEFINES RDT-MRCH-ACCOUNT- NUMBER PIC X(16).
Can you please tell me is there any specified start position of 01,05 levels?
Rumu
IT Consultant
IT Consultant
I explained the format requirement in the third post on this page: every line must start in position 8. You can indent higher level number lines for ease of reading, but it's not required.
If your copy/paste of the REDEFINES line is accurate, you have a space following the last hypen, ACCOUNT- NUMBER. That will cause a parsing error.
If your copy/paste of the REDEFINES line is accurate, you have a space following the last hypen, ACCOUNT- NUMBER. That will cause a parsing error.
Franklin Evans
"Shared pain is lessened, shared joy increased. Thus do we refute entropy." -- Spider Robinson
Using mainframe data FAQ: viewtopic.php?t=143596 Using CFF FAQ: viewtopic.php?t=157872
"Shared pain is lessened, shared joy increased. Thus do we refute entropy." -- Spider Robinson
Using mainframe data FAQ: viewtopic.php?t=143596 Using CFF FAQ: viewtopic.php?t=157872
Hi Frank,
I have mistaken your third post, I thought it is for 01 level, the start position is required to be 08..So this 8 should be the start position of each of the line.
Regarding my code , I removed that space before Number and tried,but same error.
What I did ,as below and could read it .
as below:
But encountered another issue n later part as below:
In the above redefine clause, I found same error so what I did as similar to above like creating a level:
Now only 1 error is there which says expecting a '.' before 20. But a '.' is there before 20 ie in the redefine line. Why this error is coming?
I have mistaken your third post, I thought it is for 01 level, the start position is required to be 08..So this 8 should be the start position of each of the line.
Regarding my code , I removed that space before Number and tried,but same error.
What I did ,as below and could read it .
as below:
Code: Select all
01 RDT-DATA.
05 RDT-HEAD.
10 RDT-MRCH-AGENT-NO PIC X(4).
10 RDT-MRCH-ACCOUNT-NUMBER PIC X(16).
10 RDT-DR-MERCHANT-NUMBER1 REDEFINES RDT-MRCH-ACCOUNT-NUMBER.
15 RDT-DR-MERCHANT-NUMBER PIC X(16).
Code: Select all
10 RDT-MERCHANT-DESC.
15 FILLER PIC X(6).
15 RDT-AUTH-TYPE-FOR-DA PIC X.
15 RDT-TRANSACTION-TYPE PIC X.
15 RDT-DECLINE-REASON PIC S9(2).
15 RDT-DCLN-RESN-REDF-CD REDEFINES RDT-DECLINE-REASON PIC X(2).
15 RDT-EXPN-DCLN-RESN-CD PIC X(4).
15 FILLER PIC X(32).
Code: Select all
01 RDT-DATA.
05 RDT-HEAD.
10 RDT-MERCHANT-DESC.
15 FILLER PIC X(6).
15 RDT-AUTH-TYPE-FOR-DA PIC X.
15 RDT-TRANSACTION-TYPE PIC X.
15 RDT-DECLINE-REASON PIC S9(2).
15 RDT-DCLN-RESN-REDF-CD1 REDEFINES RDT-DECLINE-REASON.
20 RDT-DCLN-RESN-REDF-CD PIC X(2).
15 RDT-EXPN-DCLN-RESN-CD PIC X(4).
15 FILLER PIC X(32).]
Rumu
IT Consultant
IT Consultant
Rumu,
Your need to split the REDEFINES to a subordinate item (higher level number) is very odd. I have many successfully imported copybooks that have the PIC clause on the REDEFINES item.
The expected period error is not one I can help you with. Sometimes, if you used copy/paste for the line, retyping it manually will clear that up. Otherwise, it could just be gremlins in the system giving you a hard time.
Your need to split the REDEFINES to a subordinate item (higher level number) is very odd. I have many successfully imported copybooks that have the PIC clause on the REDEFINES item.
The expected period error is not one I can help you with. Sometimes, if you used copy/paste for the line, retyping it manually will clear that up. Otherwise, it could just be gremlins in the system giving you a hard time.
Franklin Evans
"Shared pain is lessened, shared joy increased. Thus do we refute entropy." -- Spider Robinson
Using mainframe data FAQ: viewtopic.php?t=143596 Using CFF FAQ: viewtopic.php?t=157872
"Shared pain is lessened, shared joy increased. Thus do we refute entropy." -- Spider Robinson
Using mainframe data FAQ: viewtopic.php?t=143596 Using CFF FAQ: viewtopic.php?t=157872