Jeff Westman wrote: > Hi, > > I've got some files, that were written with a COBOL program, so I > have fields that have been created with COMP (binary) "picture" > clauses. The problem is now I need to read this file into a perl > program. Here's what I have: > > 05 RECORD-TYPE PIC X. > 05 LOC-ID PIC S9(4) COMP. > 05 PO-ID PIC S9(8) COMP. > 05 SHIP-ID PIC X(8). > 05 SHIP-DT PIC S9(8) COMP. > (etc) > > Is there a way to break-down the COMP fields into a readable format? > If I recall from my COBOL days, a signed-COMP(4) will take up 3 > bytes. How can I read this file?? > > > -Jeff > Really depends what machine you are getting the data from. I have fields for comp which run like: a) comp [s]9(4) two bytes b) comp [s]9(9) four bytes where [s] implies optional
For me I use from the pack/unpack template characters: a) <- n which is Short in network (big endian) byte order b) <- N which is long in network (big endian) byte order Also for a) I have used s for Signed short value and the values have come out as expected. Look at the pack/unpack info to assist. Wags ;) ********************************************************** This message contains information that is confidential and proprietary to FedEx Freight or its affiliates. It is intended only for the recipient named and for the express purpose(s) described therein. Any other use is prohibited. **************************************************************** -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]