cobol copy book metadata

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
hargun
Participant
Posts: 188
Joined: Mon May 16, 2011 7:41 pm
Location: United States

cobol copy book metadata

Post by hargun »

hi,

i tried to import the metadata using the cobol file definition but getting the below error

Error 1(line2)'PIC' PICTURE character string contains unsupported editing characters
Error 6 (line12) 'PIC' PICTURE character string format is invalid.

i am using sequential file to read the file and using the metadata over there.


The copy book is given below

Code: Select all

       01  TXT004-WORK-RECORD.
           03  TXT004-CIT-ITEM-NO     PIC -9(10).
           03  TXT004-C1              PIC X.
           03  TXT004-CIT-OBG-NO      PIC -9(10).
           03  TXT004-C2              PIC X.
           03  TXT004-CIT-BNK-NO      PIC -9(5).
           03  TXT004-C3              PIC X.
           03  TXT004-CIT-VER         PIC -9(10).
           03  TXT004-C4              PIC X.
           03  TXT004-CIT-COL-TYPE    PIC -9(5).
           03  TXT004-C5              PIC X.
           03  TXT004-CIT-COL-VALUE   PIC -9(13).9(2).
           03  TXT004-C6              PIC X.
           03  TXT004-CIT-EFF-DT      PIC X(10).
           03  TXT004-C7              PIC X.
           03  TXT004-CIT-ADVANCE-PCT PIC -9(1).9(14).
           03  TXT004-C8              PIC X.
           03  TXT004-CIT-UNITS       PIC -9(7).9(6).
           03  TXT004-C9              PIC X.
           03  TXT004-CIT-FUNCTION-TYP PIC -9(5).
           03  TXT004-C10             PIC X.
           03  TXT004-CIT-LOCATION-HLD PIC -9(10).
           03  TXT004-C11             PIC X.
           03  TXT004-A1              PIC X.
           03  TXT004-CIT-SECURITY-NO PIC X(13).
           03  TXT004-A2              PIC X.
           03  TXT004-C12             PIC X.
           03  TXT004-A3              PIC X.
           03  TXT004-CIT-TRUST-RCT-No PIC X(15).
           03  TXT004-A4              PIC X.
           03  TXT004-C13             PIC X.
           03  TXT004-A5              PIC X.
           03  TXT004-CIT-DESCRIPT-1  PIC X(30).
           03  TXT004-A6              PIC X.
           03  TXT004-C14             PIC X.
           03  TXT004-A7              PIC X.
           03  TXT004-CIT-DESCRIPT-2  PIC X(30).
           03  TXT004-A8              PIC X.
           03  TXT004-C15             PIC X.
           03  TXT004-CIT-NO-PIECES   PIC -9(7).
           03  TXT004-C16             PIC X.
           03  TXT004-CIT-CURR-UNIT-PR PIC -9(13).9(2).
           03  TXT004-C17             PIC X.
           03  TXT004-CIT-ORIG-VALUE  PIC -9(13).9(2).
           03  TXT004-C18             PIC X.
           03  TXT004-CIT-NET-COL-VAL PIC -9(13).9(2).
           03  TXT004-C19             PIC X.
           03  TXT004-CIT-NET-USEABLE PIC -9(13).9(2).
           03  TXT004-C20             PIC X.
           03  TXT004-CIT-MAX-LENDABLE PIC -9(13).9(2).
           03  TXT004-C21             PIC X.
           03  TXT004-CIT-REGU-ADV-PCT PIC -9(1).9(14).
           03  TXT004-C22             PIC X.
           03  TXT004-CIT-DIVISION    PIC -9(5).
           03  TXT004-C23             PIC X.
           03  TXT004-CIT-REGION      PIC -9(5).
           03  TXT004-C24             PIC X.
           03  TXT004-CIT-SERV-UNIT   PIC -9(5).
           03  TXT004-C25             PIC X.
           03  TXT004-CIT-ASSIGN-UNIT PIC -9(5).
           03  TXT004-C26             PIC X.
           03  TXT004-A9              PIC X.
           03  TXT004-CIT-OFFICER     PIC X(5).
           03  TXT004-A10             PIC X.
           03  TXT004-C27             PIC X.
           03  TXT004-CIT-LOCAT-RCVD  PIC -9(10).
           03  TXT004-C28             PIC X.
           03  TXT004-CIT-FRGN-CUR-CD PIC -9(10).
           03  TXT004-C29             PIC X.
           03  TXT004-CIT-POST-DT     PIC X(10).
           03  TXT004-C30             PIC X.
           03  TXT004-CIT-EXPIRED-DT  PIC X(10).
           03  TXT004-C31             PIC X.
           03  TXT004-CIT-LST-VALUE-DT PIC X(10).
           03  TXT004-C32             PIC X.
           03  TXT004-CIT-SHIPPING-DT PIC X(10).
           03  TXT004-C33             PIC X.
           03  TXT004-CIT-ADVANCE-DT  PIC X(10).
           03  TXT004-C34             PIC X.
           03  TXT004-CIT-ADVANCE-AMT PIC -9(13).9(2).
           03  TXT004-C35             PIC X.
           03  TXT004-CIT-RT-OF-RETURN PIC -9(1).9(14).
           03  TXT004-C36             PIC X.
           03  TXT004-A11             PIC X.
           03  TXT004-CIT-EXCEPT-CD   PIC X(3).
           03  TXT004-A12             PIC X.
           03  TXT004-C37             PIC X.
           03  TXT004-A13             PIC X.
#31018     03  TXT004-CIT-DEP-ACCT-1  PIC X(17).
           03  TXT004-A14             PIC X.
           03  TXT004-C38             PIC X.
           03  TXT004-A15             PIC X.
#31018     03  TXT004-CIT-DEP-ACCT-2  PIC X(17).
           03  TXT004-A16             PIC X.
           03  TXT004-C39             PIC X.
           03  TXT004-A17             PIC X.
           03  TXT004-CIT-AUDIT-FREQ  PIC X(1).
           03  TXT004-A18             PIC X.
           03  TXT004-C40             PIC X.
           03  TXT004-CIT-LST-AUDIT-DT PIC X(10).
           03  TXT004-C41             PIC X.
           03  TXT004-CIT-NXT-AUDIT-DT PIC X(10).
           03  TXT004-C42             PIC X.
           03  TXT004-A19             PIC X.
           03  TXT004-CIT-INSPECT-FREQ PIC X(1).
           03  TXT004-A20             PIC X.
           03  TXT004-C43             PIC X.
           03  TXT004-CIT-LST-INSP-DT PIC X(10).
           03  TXT004-C44             PIC X.
           03  TXT004-CIT-NXT-INSP-DT PIC X(10).
           03  TXT004-C45             PIC X.
           03  TXT004-A21             PIC X.
           03  TXT004-CIT-COUPON-FREQ PIC X(1).
           03  TXT004-A22             PIC X.
           03  TXT004-C46             PIC X.
           03  TXT004-A23             PIC X.
           03  TXT004-CIT-COUPON-INST PIC X(1).
           03  TXT004-A24             PIC X.
           03  TXT004-C47             PIC X.
           03  TXT004-CIT-LST-COUP-DT PIC X(10).
           03  TXT004-C48             PIC X.
           03  TXT004-CIT-NXT-COUP-DT PIC X(10).
           03  TXT004-C49             PIC X.
           03  TXT004-CIT-FST-COUP-AMT PIC -9(13).9(2).
           03  TXT004-C50             PIC X.
           03  TXT004-CIT-REG-COUP-AMT PIC -9(13).9(2).
           03  TXT004-C51             PIC X.
           03  TXT004-CIT-SPL-MAIL-REC PIC -9(5).
           03  TXT004-C52             PIC X.
           03  TXT004-A25             PIC X.
           03  TXT004-CIT-CNTL-STCK-CD PIC X(1).
           03  TXT004-A26             PIC X.
           03  TXT004-C53             PIC X.
           03  TXT004-A27             PIC X.
           03  TXT004-CIT-SAFEKEEPG-CD PIC X(1).
           03  TXT004-A28             PIC X.
           03  TXT004-C54             PIC X.
           03  TXT004-CIT-SUBS-ITEM-NO PIC -9(5).
           03  TXT004-C55             PIC X.
           03  TXT004-A29             PIC X.
           03  TXT004-CIT-SHORT-NAME  PIC X(15).
           03  TXT004-A30             PIC X.
           03  TXT004-C56             PIC X.
           03  TXT004-CIT-USER-CD-1   PIC X.
           03  TXT004-C57             PIC X.
           03  TXT004-CIT-USER-CD-2   PIC XX.
           03  TXT004-C58             PIC X.
           03  TXT004-CIT-USER-NUM    PIC -9(15).
           03  TXT004-C59             PIC X.
           03  TXT004-A31             PIC X.
           03  TXT004-CIT-USER-ALPHA  PIC X(15).
           03  TXT004-A32             PIC X.
           03  TXT004-C60             PIC X.
           03  TXT004-CIT-USER-DT-1   PIC X(10).
           03  TXT004-C61             PIC X.
           03  TXT004-CIT-USER-DT-2   PIC X(10).
           03  TXT004-C62             PIC X.
           03  TXT004-CIT-USER-AMT-1  PIC -9(13).9(2).
           03  TXT004-C63             PIC X.
           03  TXT004-CIT-USER-AMT-2  PIC -9(13).9(2).

can someone help me on this.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

I hope that your formatting for the copybook was lost when you posted it, those definitions should begin in columns 8 and 12, but the import process should make allowances for that.

I am working on a very slow internet connection today so cannot check myself, but I am not sure that the PICture "-9" is correct, I've often used "S9" for signed, but can't recall if the "-" predicate is a valid ANSI format - since you are seeing an error message that might be the reason. Also, the construct "-9(13).9(2)" looks odd, since the decimal point is the COBOL end-of-sentence marker, this usually is displayed as "S9(13)V9(2)".

What mainframe COBOL does this copybook come from? I would try replacing the pictures with "S" and "V" rather than "-" and ".".
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Swapped out the quote tags for code tags.

And from what I recall, the decimal point in those picture clauses means it's not an implied decimal (V) but rather an explicit one there in the data so it's not something you should change. From other posts here, I think the leading minus sign might need to be replaced with an "S" as you noted Arnd for DataStage to like it. Then see if there are still errors.
-craig

"You can never have too many knives" -- Logan Nine Fingers
hargun
Participant
Posts: 188
Joined: Mon May 16, 2011 7:41 pm
Location: United States

Post by hargun »

hi arnd thanks for reply and i tried myself by replacing the pictures with "S" and "V" rather than "-" and "."and it import without any error.
please find below the copy book after correction:

Code: Select all

01  TXT004SWORKSRECORD.
           03  TXT004SCITSITEMSNO     PIC S9(10).
           03  TXT004SC1              PIC X.
           03  TXT004SCITSOBGSNO      PIC S9(10).
           03  TXT004SC2              PIC X.
           03  TXT004SCITSBNKSNO      PIC S9(5).
           03  TXT004SC3              PIC X.
           03  TXT004SCITSVER         PIC S9(10).
           03  TXT004SC4              PIC X.
           03  TXT004SCITSCOLSTYPE    PIC S9(5).
           03  TXT004SC5              PIC X.
           03  TXT004SCITSCOLSVALUE   PIC S9(13)V9(2).
           03  TXT004SC6              PIC X.
           03  TXT004SCITSEFFSDT      PIC X(10).
           03  TXT004SC7              PIC X.
           03  TXT004SCITSADVANCESPCT PIC S9(1)V9(14).
           03  TXT004SC8              PIC X.
           03  TXT004SCITSUNITS       PIC S9(7)V9(6).
           03  TXT004SC9              PIC X.
           03  TXT004SCITSFUNCTIONSTYP PIC S9(5).
           03  TXT004SC10             PIC X.
           03  TXT004SCITSLOCATIONSHLD PIC S9(10).
           03  TXT004SC11             PIC X.
           03  TXT004SA1              PIC X.
           03  TXT004SCITSSECURITYSNO PIC X(13).
           03  TXT004SA2              PIC X.
           03  TXT004SC12             PIC X.
           03  TXT004SA3              PIC X.
           03  TXT004SCITSTRUSTSRCTSNo PIC X(15).
           03  TXT004SA4              PIC X.
           03  TXT004SC13             PIC X.
           03  TXT004SA5              PIC X.
           03  TXT004SCITSDESCRIPTS1  PIC X(30).
           03  TXT004SA6              PIC X.
           03  TXT004SC14             PIC X.
           03  TXT004SA7              PIC X.
           03  TXT004SCITSDESCRIPTS2  PIC X(30).
           03  TXT004SA8              PIC X.
           03  TXT004SC15             PIC X.
           03  TXT004SCITSNOSPIECES   PIC S9(7).
           03  TXT004SC16             PIC X.
           03  TXT004SCITSCURRSUNITSPR PIC S9(13)V9(2).
           03  TXT004SC17             PIC X.
           03  TXT004SCITSORIGSVALUE  PIC S9(13)V9(2).
           03  TXT004SC18             PIC X.
           03  TXT004SCITSNETSCOLSVAL PIC S9(13)V9(2).
           03  TXT004SC19             PIC X.
           03  TXT004SCITSNETSUSEABLE PIC S9(13)V9(2).
           03  TXT004SC20             PIC X.
           03  TXT004SCITSMAXSLENDABLE PIC S9(13)V9(2).
           03  TXT004SC21             PIC X.
           03  TXT004SCITSREGUSADVSPCT PIC S9(1)V9(14).
           03  TXT004SC22             PIC X.
           03  TXT004SCITSDIVISION    PIC S9(5).
           03  TXT004SC23             PIC X.
           03  TXT004SCITSREGION      PIC S9(5).
           03  TXT004SC24             PIC X.
           03  TXT004SCITSSERVSUNIT   PIC S9(5).
           03  TXT004SC25             PIC X.
           03  TXT004SCITSASSIGNSUNIT PIC S9(5).
           03  TXT004SC26             PIC X.
           03  TXT004SA9              PIC X.
           03  TXT004SCITSOFFICER     PIC X(5).
           03  TXT004SA10             PIC X.
           03  TXT004SC27             PIC X.
           03  TXT004SCITSLOCATSRCVD  PIC S9(10).
           03  TXT004SC28             PIC X.
           03  TXT004SCITSFRGNSCURSCD PIC S9(10).
           03  TXT004SC29             PIC X.
           03  TXT004SCITSPOSTSDT     PIC X(10).
           03  TXT004SC30             PIC X.
           03  TXT004SCITSEXPIREDSDT  PIC X(10).
           03  TXT004SC31             PIC X.
           03  TXT004SCITSLSTSVALUESDT PIC X(10).
           03  TXT004SC32             PIC X.
           03  TXT004SCITSSHIPPINGSDT PIC X(10).
           03  TXT004SC33             PIC X.
           03  TXT004SCITSADVANCESDT  PIC X(10).
           03  TXT004SC34             PIC X.
           03  TXT004SCITSADVANCESAMT PIC S9(13)V9(2).
           03  TXT004SC35             PIC X.
           03  TXT004SCITSRTSOFSRETURN PIC S9(1)V9(14).
           03  TXT004SC36             PIC X.
           03  TXT004SA11             PIC X.
           03  TXT004SCITSEXCEPTSCD   PIC X(3).
           03  TXT004SA12             PIC X.
           03  TXT004SC37             PIC X.
           03  TXT004SA13             PIC X.
#31018     03  TXT004SCITSDEPSACCTS1  PIC X(17).
           03  TXT004SA14             PIC X.
           03  TXT004SC38             PIC X.
           03  TXT004SA15             PIC X.
#31018     03  TXT004SCITSDEPSACCTS2  PIC X(17).
           03  TXT004SA16             PIC X.
           03  TXT004SC39             PIC X.
           03  TXT004SA17             PIC X.
           03  TXT004SCITSAUDITSFREQ  PIC X(1).
           03  TXT004SA18             PIC X.
           03  TXT004SC40             PIC X.
           03  TXT004SCITSLSTSAUDITSDT PIC X(10).
           03  TXT004SC41             PIC X.
           03  TXT004SCITSNXTSAUDITSDT PIC X(10).
           03  TXT004SC42             PIC X.
           03  TXT004SA19             PIC X.
           03  TXT004SCITSINSPECTSFREQ PIC X(1).
           03  TXT004SA20             PIC X.
           03  TXT004SC43             PIC X.
           03  TXT004SCITSLSTSINSPSDT PIC X(10).
           03  TXT004SC44             PIC X.
           03  TXT004SCITSNXTSINSPSDT PIC X(10).
           03  TXT004SC45             PIC X.
           03  TXT004SA21             PIC X.
           03  TXT004SCITSCOUPONSFREQ PIC X(1).
           03  TXT004SA22             PIC X.
           03  TXT004SC46             PIC X.
           03  TXT004SA23             PIC X.
           03  TXT004SCITSCOUPONSINST PIC X(1).
           03  TXT004SA24             PIC X.
           03  TXT004SC47             PIC X.
           03  TXT004SCITSLSTSCOUPSDT PIC X(10).
           03  TXT004SC48             PIC X.
           03  TXT004SCITSNXTSCOUPSDT PIC X(10).
           03  TXT004SC49             PIC X.
           03  TXT004SCITSFSTSCOUPSAMT PIC S9(13)V9(2).
           03  TXT004SC50             PIC X.
           03  TXT004SCITSREGSCOUPSAMT PIC S9(13)V9(2).
           03  TXT004SC51             PIC X.
           03  TXT004SCITSSPLSMAILSREC PIC S9(5).
           03  TXT004SC52             PIC X.
           03  TXT004SA25             PIC X.
           03  TXT004SCITSCNTLSSTCKSCD PIC X(1).
           03  TXT004SA26             PIC X.
           03  TXT004SC53             PIC X.
           03  TXT004SA27             PIC X.
           03  TXT004SCITSSAFEKEEPGSCD PIC X(1).
           03  TXT004SA28             PIC X.
           03  TXT004SC54             PIC X.
           03  TXT004SCITSSUBSSITEMSNO PIC S9(5).
           03  TXT004SC55             PIC X.
           03  TXT004SA29             PIC X.
           03  TXT004SCITSSHORTSNAME  PIC X(15).
           03  TXT004SA30             PIC X.
           03  TXT004SC56             PIC X.
           03  TXT004SCITSUSERSCDS1   PIC X.
           03  TXT004SC57             PIC X.
           03  TXT004SCITSUSERSCDS2   PIC XX.
           03  TXT004SC58             PIC X.
           03  TXT004SCITSUSERSNUM    PIC S9(15).
           03  TXT004SC59             PIC X.
           03  TXT004SA31             PIC X.
           03  TXT004SCITSUSERSALPHA  PIC X(15).
           03  TXT004SA32             PIC X.
           03  TXT004SC60             PIC X.
           03  TXT004SCITSUSERSDTS1   PIC X(10).
           03  TXT004SC61             PIC X.
           03  TXT004SCITSUSERSDTS2   PIC X(10).
           03  TXT004SC62             PIC X.
           03  TXT004SCITSUSERSAMTS1  PIC S9(13)V9(2).
           03  TXT004SC63             PIC X.
           03  TXT004SCITSUSERSAMTS2  PIC S9(13)V9(2).
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Ok... imported now but is it working for you? While the "S" and the "-" are equivalents, the "V" and the "." are not.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

My connection is at about 4800 Baud right now, so I can't check the ANSI standards; I think Craig is correct, in that the "-" and "." denote explicit values, and using the "S" and "V" pictures might work, at least for the leading sign, but I'd check the assumed decimal point values with what is in the input files. I am surprised that the "." construct gets parsed correctly, this is most likely limited to one implementation.
clmhwybe
Premium Member
Premium Member
Posts: 8
Joined: Mon Jun 18, 2012 1:43 pm

Post by clmhwybe »

the problem with the copybook is that its denoting the number fields in the display format (for which the mainframe have defined the fields to be used for diaplay), and replacing the "-" with S and and decimal to implied decimal will import the cipybook correctly and will reference the data coming from mainframe with correct precision.
priyadarshikunal
Premium Member
Premium Member
Posts: 1735
Joined: Thu Mar 01, 2007 5:44 am
Location: Troy, MI

Post by priyadarshikunal »

-9 is zoned decimal from what I remember, which means this file is flattened in mainframe logic itself. You do not need a CFD in that case as there is no packed decimal in your file if this CFD definition is correct, just use sequential file stage and define them as decimal instead of binary.
Priyadarshi Kunal

Genius may have its limitations, but stupidity is not thus handicapped. :wink:
priyadarshikunal
Premium Member
Premium Member
Posts: 1735
Joined: Thu Mar 01, 2007 5:44 am
Location: Troy, MI

Post by priyadarshikunal »

also try to view that file in vi or other tool if you can see data correctly.

If you are not able to see PIC X either correctly,try converting it from EBCDIC to ASCII using "dd" command in unix.
Priyadarshi Kunal

Genius may have its limitations, but stupidity is not thus handicapped. :wink:
clmhwybe
Premium Member
Premium Member
Posts: 8
Joined: Mon Jun 18, 2012 1:43 pm

Post by clmhwybe »

kunal,
what is posted is the copybook layout and -9 shows that the usage is display for the field, IT DOES NOT ESSENTIALLY HAVE TO BE A FLATTENED FILE.
as i see no comp3 var in the layout it will be perfectlly fine and viewable using the vi and other tools on Unix/Linux.
priyadarshikunal
Premium Member
Premium Member
Posts: 1735
Joined: Thu Mar 01, 2007 5:44 am
Location: Troy, MI

Post by priyadarshikunal »

yes it doesn't have to be a flattend file. Since there is no "USAGE COMP or COMP-3" also all the element's level number is same 03, it does look flat to me.

below is an excerpt form mainframe tutorials

Display format is the default for numbers in COBOL. If no "usage is" clause is specified, the default is "usage is display", which means the value is stored as EBCDIC characters (digits), as opposed to binary. The value may or may not have a decimal -- implied or real -- and may be unsigned or have an embedded or a separate sign -- which can be either leading or trailing. The default "signed display" format field contains an embedded trailing sign, and is commonly called a "Signed", or "IBM Signed", or "Zoned" field. This data type is described below.
Priyadarshi Kunal

Genius may have its limitations, but stupidity is not thus handicapped. :wink:
FranklinE
Premium Member
Premium Member
Posts: 739
Joined: Tue Nov 25, 2008 2:19 pm
Location: Malvern, PA

Post by FranklinE »

I'm skeptical that the file is readable after replacing "." with "V". It should mean that the original copybook itself was wrong.

The one-byte storage for the explicit decimal is required, and cannot be read using the implied decimal. Both are display formats, but the storage length will be off by one.

The "-" is a Cobol I edit control. Another example is zero-suppress "Z", also called floating insertion. DataStage has troule with them, and the best-practice approach is to convert display decimal to alphanumeric on input and use a transformer derivation to edit it for the decimal value and sign.
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
Post Reply