COBOL/400 FD entry

715 pts.
Tags:
AS 400
COBOL
Inquiry (related to COBOL/400):
Q1. How to declare more than one 'record key' in 'file-control' for a single LF with  multiple record formats with multiple key(s)
Q2. How to create multiple storage areas, one each for each record for the same LF.
---------------------------------------------------------------------------------------------------
1. This is the LF which has 2 record formats with 2 different Key definitions.
R RL1PRHR PFILE( RPFPNRH )
   RCOCD
   RPNR
   RDTDP
K RCOCD
K RPNR
R RL1PRDR PFILE( RPFPNRD )
    RCOCD
    RPNR
    RPNRSR
    RPSNA
K RCOCD 
K RPNR  
K RPNRSR
 
2, This is the file-control statements
select dbf1_file
         assign        to  database-RL1PNR
         organization    is  indexed
         access mode   is  dynamic
         record key       is  kds_dbf1
         file status         is  dbf1_status.
3. This is the file section
fd   dbf1_file.                               
01  dbf_rec.                                 
      copy  dds-all-formats of RL1PNR.         
01  kds_dbf1.                                
    10  RCOCD        like RCOCD  of RL1PRHR.  
    10  RPNR           like RPNR     of RL1PRHR.  
 
3. This is the working-storage section
  01  RL1PRHR_rec.
      copy  dds-RL1PRHR of RL1PNR.
* 01  RL1PRDR_rec.
*     copy  dds-RL1PRDR of RL1PNR.
------------------------------------------------------------------
I have referred pg 578 of IBM's 'Websphere dev studio: ILE COBOL ref ver 5' manual which explains how to create multiple record formats of dbf but could not get that working
-----------------------------------------------------------------
I have attempted (without success) (a) omitting FD in file section and instead defined 2 rec formats in working-storage section (b) defined FD in file section with 'copy  dds-all-formats' and two separate 'copy  dds-' statements in working-storage section. In both the cases I get all kinds compilation errors which cannot be listed here.
Eventually, the code shown above goes thru error free. However, I could not declare multiple keys and could not get separate storage areas for 2 record formats of a single LF which is my intent.
Would appreciate someone throwing light on these issues.
Thanks
 
 


Software/Hardware used:
AS400 OS400 DB2

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: