Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help on using copybook library

Status
Not open for further replies.

happyallday

Technical User
Oct 1, 2007
11
CA
Sorry I have never used cobol before.

Now I am giving a file name and a copybook library from our IS department, now I want to use copybook to convert the file to something can be understood.

Can you let me know how to use it please?

Thanks!!
 
Marc,

Now with option 1, I can view the file. You just made my day!! Thanks! Thanks! Thanks!

So the next step for me is, is it possible to use fileaid convert that file, can you point me a direction again please?


 
Happy,
define 'convert'. How do you wish to convert it and what do you wish to do with it?

By the way, are you looking at the file in fileaid combined with the copybook? That way you will be able to see each field name on the file and the value of each field.

Marc
 

I am seeing the data in fileaid combined with the copybook library. I am happy with what I see, but how can I download the data, it's not like I open something in Excel and use "Save as". So the convert for me means I can download the data the way it is showing in fileaid now.

Thanks!!
 
Happy,
I'm fairly certain that all you wish to do with the file can be done on the mainframe, but, your experience lies elsewhere so it seems sensible to bring the file to the PC and process it there, if that is where you are happier.

There are numerous ways of getting the data to the PC, usually your mainframe emulation software will have a file transfer option, but I'll let others here advise you better.

One thing I will ask though, is if the file is sourced from a database system (db2 for instance) that is available via ODBC. It could be that you could open a spreadsheet and drag the data into it via MS SQL off the mainframe.

Hope my ramblings have been of help.

Marc
 
Thanks Marc,

The data from this file is only one source of the final report, so I guess I will have to download it first then link to the other sources in PC for the final report.

If the data can be accessed through ODBC, I guess I would be told already, but I will ask IS department anyway.

I know I can transfer files through TSO, but this way I only got the encoded (I guess comp-3) file, so how do I use "transfer" files through TSO but get the decoded(same format as I see in file-aid with copybook right now)

I really appreciate the time & help you have spent on this, if you are in Toronto I will buy you a drink for sure.

 
I know I can transfer files through TSO, but this way I only got the encoded (I guess comp-3) file, so how do I use "transfer" files through TSO but get the decoded(same format as I see in file-aid with copybook right now)

It's been a long time since I dealt with file transfers, but if you can get the file and there's nothing too wierd in it, you can always convert it on the PC side, too, assuming the file comes across with the same bytes and are not translated. In other words, you see the same data byte wise on the PC and on the mainframe.

It depends on what you get when you transfer the file, and whether there's a better option (I'm sure there's someone that will say something).
 
Happyallday,

You didn't show us your copybook yet. Now there is the time to do one of the following things:

1) convert your file on the mainframe to a data type that is not destroyed by ebcdic-ascii conversion. This can be done by cobol but also a good-old iebgener can do the job if we know your copybook..... Do you have a mainframe cobol compiler available for yourself?

2) it is possible to do a binary download and convert the result with a pc-cobol program to something you can handle in ascii. If I have your copybook, it is easy to create a program in realia cobol that does the job.

Regards,

Crox






 
Happy,

Before anybody goes writing programs I will just ask again where the file is sourced from.

Marc
 
I tried to download copybook by doing this:

RECEIVE HBF1418D.COB 'HSTLB.PRD.COPY(HBF1418D)' ASCII CRLF

but it gave me the error:
INVALID KEYWORD, HBF1418D.COB
REENTER THIS OPERAND -

So I open the copybook in fileaid and copied it manually, not sure I got it right, please see the data below:

000001 ******************************************************************00010000
000002 * HBF1418D EVNT SKU PLAN EXCEL LENGTH=218 00020003
000003 ******************************************************************00030000
000004 01 HBF1418D-RECORD. 00040000
000005 05 HBF1418D-EVENT-START-DATE PIC X(10). 00041100
000006 05 HBF1418D-VNDR-NBR PIC S9(08) COMP-3. 00050000
000007 05 HBF1418D-VNDR-NAME PIC X(20). 00050200
000008 05 HBF1418D-GMA-NBR PIC S9(04) COMP-3. 00050400
000009 05 HBF1418D-GRP-NBR PIC S9(04) COMP-3. 00050600
000010 05 HBF1418D-DEPT-NBR PIC S9(04) COMP-3. 00050800
000011 05 HBF1418D-CAT-NBR PIC S9(04) COMP-3. 00051000
000012 05 HBF1418D-DU-NBR PIC S9(04) COMP-3. 00051200
000013 05 HBF1418D-SKU-NBR PIC S9(08) COMP-3. 00051600
000014 05 HBF1418D-SKU-DSC-ENG PIC X(40). 00051800
000015 05 HBF1418D-COLOUR-CDE PIC 9(04). 00052000
000016 05 HBF1418D-SIZE-CDE PIC X(06). 00052200
000017 05 HBF1418D-BASE-RETAIL PIC 9(14)V9999. 00052400
000018 05 HBF1418D-EST-LAND-COST PIC S9(14)V9(04). 00052600
000019 05 HBF1418D-EVNT-CDE PIC X(06). 00053000
000020 05 HBF1418D-EST-EVNT-SHIP-DTE PIC X(10). 00070001
000021 05 HBF1418D-FRCST-QTY PIC S9(07) COMP-3. 00130000
000022 05 HBF1418D-NO-HISTORY-IND PIC X(36). 00140000
000023 05 HBF1418D-VPN PIC X(20). 00141000
000024 05 HBF1418D-SUBSID-CDE PIC X(01). 00143000
000025
****** **************************** Bottom of Data ****************************


Also I found a software called TextPipe Pro, it seems be able to convert comp-3 with copybook, I used the copybook data above, but the result is still not recognizable.
 
Here's what some of these things mean (you should be able to handle most of it):

01 HBF1418D-RECORD.

This is the identifier for the record - a grouped unit named this.

HBF1418D-EVENT-START-DATE PIC X(10).

This is an array/table of 10 characters - you should have an analogous type for whatever it is you are doing on the PC.

HBF1418D-VNDR-NBR PIC S9(08) COMP-3.

This is a signed packed-decimal.
+1234 it will store in binary (hex) $00 $00 $01 $23 $4C.
-1234 is $00 $00 $01 $23 $4D.
If no sign then $00 $00 $01 $23 $4F.
This type as defined should always have an associated sign.

This type will be the trick to handle within this data set. If you do decide to handle it on the PC side yourself (I'm sure someone will help though), I can find some code to make the conversion for you.

The 08 part says to store a maximum of eight digits. The size of this is (Num div 2) + 1. S9(04) COMP-3 is 3 bytes, S9(03) COMP-3 is 2 bytes, S9(08) COMP-3 is 5 bytes.

HBF1418D-COLOUR-CDE PIC 9(04).

This is a 4 byte array/table of characters. Unsigned, and represents a number without any decimal points or signs. 1234 is literally stored as "1234" in the file.

HBF1418D-BASE-RETAIL PIC 9(14)V9999.

This is similar to the previous datatype. This is an 18 byte array/table of characters which may hold only numerals. The V represents an implied decimal point - the decimal point is not stored within the file, but by inference of the data type, it is treated as if it is there.

1234.56 is stored as "000000000012345600" in this data type.

Again, COMP-3 probably is going to be the only type that will get messy if you were just to download the data-set, and any one of us I think can help you solve that. Otherwise, most of this stuff looks to be things that can be handled easily in whatever PC language you use.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top