IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

PUTENV UTILITY How to reopen previously allocated files


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
SVazifdar

New User


Joined: 21 Apr 2006
Posts: 14

PostPosted: Sat Mar 07, 2009 3:09 am
Reply with quote

I used the PUTENV example to dynamically allocate files and it works fine. However I would like to enhance the program to do the following and would like know if it is possible.

I have a file that has header records for several customers and detail records. However the header and details for the same customer appear at different places in the file. At the present time I do not want to sort the file.

Customer1
Details
Customer2
Details
Customer1
Details
Customer3
Details
Customer1
Details
Customer4
Details


I have a program that dynamically allocates files and writes records to the files.

I allocate the file for customer1, write records, and close the file for customer1. That works fine. Next I allocate file for customer2, write records, and close the file. That works fine.

Now I would to process customer1 again so I want reopen the previously allocate file for customer1 and append records to it. Is that possible and how could it be done. Please help.

Thanks

S. Vazifdar
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sat Mar 07, 2009 3:23 am
Reply with quote

Hello,

Quote:
Is that possible and how could it be done.
It can in assembler. . . Most organizations do not want to increase the amount of assembler code they must maintain. I don't know about PUTENV. Sorry.

You might consider initially reading the file as it is, making a copy of the records needed for your process and sorting those copied records. The originial file would remain as it is and the copy would be in the order needed for your process.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sat Mar 07, 2009 10:04 am
Reply with quote

Hi,

You might try to use a MOD disposition. If that doesn't work, a FREE=CLOSE along with the MOD might do the trick.
Back to top
View user's profile Send private message
Douglas Wilder

Active User


Joined: 28 Nov 2006
Posts: 305
Location: Deerfield IL

PostPosted: Mon Mar 09, 2009 9:15 pm
Reply with quote

If you do not close nor free the file for customer1 and use a different ddname for customer2, you could just write to the customer1 and customer2 files as needed. Otherwise you would need to free the ddname and re-allocate customer1 with disp=mod. This will add a lot of overhead to the process, and I believe that it would save resources to sort the file so that this is not needed.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts REASON 00D70014 in load utility DB2 6
Search our Forums:

Back to Top