Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

PUTENV UTILITY How to reopen previously allocated files

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: PUTENV UTILITY How to reopen previously allocated files
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

Site Director


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

PostPosted: Sat Mar 07, 2009 3:23 am    Post subject:
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    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to Use DebugTool CodeCoverage Uti... neo4u IBM Tools 0 Thu Jun 22, 2017 6:38 pm
No new posts Search utility(3.14) using JCl and Cobol RKS3 COBOL Programming 12 Sat Jun 10, 2017 10:24 pm
No new posts getting three output files out of JOI... migusd SYNCSORT 7 Mon Jun 05, 2017 11:30 pm
No new posts Release quantity that was allocated v... Auryn JCL & VSAM 5 Thu May 18, 2017 6:02 pm
No new posts DB2 - TERMINATE utility vasanthz DB2 5 Mon May 15, 2017 11:49 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us