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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Logical File Packed Data

Status
Not open for further replies.

gdkz

Programmer
Nov 21, 2002
44
US
I would like to make a logical file/view of data contained in a physical file.
The data is comp3 data contained within a character field.
The physical file layout for this field is:
Code:
Field1 pic x(283)
the panel accessing this table uses a copy book to define it as:
Code:
Field1 pic x(100)
Field2 pic x(100)
Field3 pic x(7)
Field4 pic s9(04)v9(03) comp-3.
Field5 pic x(72)
The panel packs the data and inserts it into Field4. One problem is that the packed data is a substring of the character field. I would like to make logical file to display the data as the copy book does.
Hopefull, I have given enough info on this problem, will add more if necessary.
Is this possible?

Thanks,
Greg
 
You are not missing something, it is probably just my lack of experience in the cobol world, as I am new to it.
I am unfamiliar with redefine and if it can be used in a logical file.
Thanks for your patience.

Thanks,
Greg
 
Greg,

You are using several terms, such as logical file, table, and panel, that have imprecise meanings in the land of COBOL. Perhaps you could restate your problem with a bit more detail regarding the computing environment and application. Include such information as compiler, hardware platform, etc. All this will provide some handles that we can grab. [bigsmile]

Tom Morrison
 
Sure, we are using the IBM I-series box on the AS/400 with a DB2 backend. We are using a proprietary software package and trying to interface with it, so we cannot change the physical file layout.
Here is the physical file layout:
Code:
       01             PTF.                                                      
           05         PTFKEY.                                                   
001          10       PTFKDIST         PIC  X(03).                              
004          10       PTFKYEAR         PIC  X(04).                              
008          10       PTFKRUN          PIC  X(03).                              
011          10       PTFKTYPE         PIC  X(01).                              
012          10       PTFKRESP         PIC  X(04).                              
012          10       PTFKBTCH         REDEFINES   PTFKRESP                     
                                       PIC  X(04).                              
016          10       PTFKPTP          PIC  X(03).                              
             10       PTFKEMPLOYEE.                                             
               20     PTFKSSN.                                                  
019              25   PTFKSSN1         PIC  X(03).                              
022              25   PTFKSSN2         PIC  X(02).                              
024              25   PTFKSSN3         PIC  X(04).                              
028              25   PTFKSSN4         PIC  X(01).                              
029            20     PTFKJOB          PIC  X(02).                              
031          10       PTFKVALU         PIC  X(13).                              
      *                                                                         
           05         PTFDATA.                                                  
             10       PTFUDATE.                                                 
044            15     PTFUCC           PIC  X(02).                              
046            15     PTFUYY           PIC  X(02).                              
048            15     PTFUMM           PIC  X(02).                              
050            15     PTFUDD           PIC  X(02).                              
             10       PTFUTIME.                                                 
052            15     PTFUHR           PIC  X(02).                              
054            15     PTFUMN           PIC  X(02).                              
056            15     PTFUSC           PIC  X(02).                              
058          10       PTFUSR           PIC  X(08).                              
066          10       PTFKNAME         PIC  X(20).                              
086          10       PTFSRCE          PIC  X(04).                              
             10       PTFPDATE.                                                 
090            15     PTFPCC           PIC  X(02).                              
092            15     PTFPYY           PIC  X(02).                              
094            15     PTFPMM           PIC  X(02).                              
096            15     PTFPDD           PIC  X(02).                              
098          10       PTFKAPTP         PIC  X(03).                              
101          10       PTFFL1           PIC  X(283).
and this is the copy book:
Code:
       01             TED.                                                      
           05         TEDKEY.                                                   
001          10       TEDKDIST         PIC  X(03).                              
004          10       TEDKYEAR         PIC  X(04).                              
008          10       TEDKRUN          PIC  X(03).                              
011          10       TEDKTYPE         PIC  X(01).                              
012          10       TEDKRESP         PIC  X(04).                              
016          10       TEDKFL1          PIC  X(03).                              
             10       TEDKSSN.                                                  
019            15     TEDKSSN1         PIC  X(03).                              
022            15     TEDKSSN2         PIC  X(02).                              
024            15     TEDKSSN3         PIC  X(04).                              
028            15     TEDKSSN4         PIC  X(01).                              
029          10       TEDKJOB          PIC  X(02).                              
             10       TEDKTIME.                                                 
031            15     TEDKDATE         PIC  9(09).                              
040            15     TEDKTME          PIC  X(03).                              
043            15     TEDKRCD          PIC  X(01).                              
      *                                                                         
           05         TEDDATA.                                                  
             10       TEDUDATE.                                                 
044            15     TEDUCC           PIC  X(02).                              
046            15     TEDUYY           PIC  X(02).                              
048            15     TEDUMM           PIC  X(02).                              
050            15     TEDUDD           PIC  X(02).                              
             10       TEDUTIME.                                                 
052            15     TEDUHR           PIC  X(02).                              
054            15     TEDUMN           PIC  X(02).                              
056            15     TEDUSC           PIC  X(02).                              
058          10       TEDUSR           PIC  X(08).                              
066          10       TEDKNAME         PIC  X(20).                              
086          10       TEDSRCE          PIC  X(04).                              
             10       TEDPDATE.                                                 
090            15     TEDPCC           PIC  X(02).                              
092            15     TEDPYY           PIC  X(02).                              
094            15     TEDPMM           PIC  X(02).                              
096            15     TEDPDD           PIC  X(02).                              
098          10       TEDKAPTP         PIC  X(03).                              
101          10       TEDPUSR          PIC  X(08).                              
109          10       TEDTMTP          PIC  X(01).                              
110          10       TEDRSN           PIC  X(03).                              
             10       TEDIDATE.                                                 
               15     TEDIYR.                                                   
113              20   TEDICC           PIC  X(02).                              
115              20   TEDIYY           PIC  X(02).                              
117            15     TEDIMM           PIC  X(02).                              
               15     TEDIDD.                                                   
119              20   TEDIDD9          PIC  9(02).                              
             10       TEDTDATE.                                                 
               15     TEDTYR.                                                   
121              20   TEDTCC           PIC  X(02).                              
123              20   TEDTYY           PIC  X(02).                              
125            15     TEDTMM           PIC  X(02).                              
               15     TEDTDD.                                                   
127              20   TEDTDD9          PIC  9(02).                              
129          10       TEDAUTH          PIC  X(20).                              
             10       TEDSSSN.                                                  
149            15     TEDSSSN1         PIC  X(03).                              
152            15     TEDSSSN2         PIC  X(02).                              
154            15     TEDSSSN3         PIC  X(04).                              
158            15     TEDSSSN4         PIC  X(01).                              
159          10       TEDSJOB          PIC  X(02).                              
161          10       TEDSTME          PIC  X(03).                              
164          10       TEDSRCD          PIC  X(01).                              
165          10       TEDSTMTP         PIC  X(01).                              
             10       TEDFDATE.                                                 
166            15     TEDFCC           PIC  X(02).                              
168            15     TEDFYY           PIC  X(02).                              
170            15     TEDFMM           PIC  X(02).                              
172            15     TEDFDD           PIC  X(02).                              
174          10       TEDUSED          PIC  X(01).                              
175          10       TEDEDR1          PIC  X(66).                              
241          10       TEDUSER1         PIC  X(66).                              
307          10       TEDTIME          PIC S9(04)V9(03) COMP-3.                 
311          10       TEDCTNTE         PIC S9(03)       COMP-3.                 
313          10       TEDSTIME         PIC S9(04)V9(03) COMP-3.                 
317          10       TEDEDR1          PIC  X(35).                              
060701*      10       TEDUSER1         PIC  X(35).                              
060701       10       TEDUSER1         PIC  X(32).

I wish to create a logical file to reference the the physical file in the format of the above copy book. The value that I am having trouble retrieving is TEDTIME. This data does not unpack when I view/query the logical file. This seems to because it is decimal data in a character field.
Does this help any.
Thanks again

Thanks,
Greg
 
With a logical view you can completely redefine the physical.

You should be able to get some examples from the infocenter manuals ( or get them installed on your site, and you should specifically search for the DDS documents (a search for logical files will give loads of exmples).

The following will "create" a field lastname made of a substring of NAME (size 10, starting at position 10)
A R REC1 PFILE(PFA)
A LASTNAME I SST(NAME 10 10)
A K LASTNAME
A

Now, this may not be needed depending on how you are dealing with the data.

Are you using this info only with COBOL, or are you trying to use SQL/DFU or other OS400 programs?

If only COBOL then you don't need to change anything, just need to figure out the correct position and type of field.

If using another application such as query/400, you need to make sure that you get the correct field type defined on your logical, and on the correct position.
Furthermore there is no need to use a COMP-3 field, and you may even be required to use another type of field, depending on how it is defined internally by your application.
How do you know that this should be defined as COMP-3?


In order to be able to give you more help I would like to have the output of DSPFFD of the PF file used by their application, and eventually a small sample file with 10/20 records max.




Regards

Frederico Fonseca
SysSoft Integrated Ltd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top