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!

Creating Multiple Files With Different Names

Status
Not open for further replies.

DJRB

Programmer
Apr 24, 2002
3
0
0
US
Hello,
I am working with Cobol in an HP3000 MPE/IX environment. I need to create a Cobol program which will sequentially read a file and break on a particular field. Upon each break I want to create a new file to which all records will be written until the next break occurs. My problem is that I want to assign a unique name to each new file. The number of files created will vary depending upon how many breaks are encountered. Each time there is a break I plan to execute an MPE BUILD command via intrinsics. Is there any way I can do this using only one SELECT/ASSIGN command for all of these files? My problem lies in identifying these files in the JCL. Here's an example:
Input data:
AAA 1234 klmf 999
AAA 1345 mkgh 111
AAA 7890 rtyu 222
BBB 6430 kred 555
CCC 4343 yemn 777
CCC 9090 mklo 888

Would result in the Building of 3 files, each with a unique name:

FILEA:
AAA 1234 klmf 999
AAA 1345 mkgh 111
AAA 7890 rtyu 222

FILEB:
BBB 6430 kred 555

FILEC:
CCC 4343 yemn 777
CCC 9090 mklo 888

My problem lies in assigning a unique name to each new file.
Any advise/suggestions would be helpful. Thanks
 
After your BUILD the file, you might try using the COMMAND intrinsic to create a file equation to the new file after you BUILD it. For instance, if you have

SELECT OUT-FILE ASSIGN TO "outfile"

.... then you programmatically (using the COMMAND intrinsic)

BUILD FILEAAA;REC=-128,,F,ACSCII

then you would (again using the COMMAND intrinsic)

FILE OUTFILE=FILEAAA

before you opened it. Would that work?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top