Hello Everyone.
I have a three COBOL programs and want them to writing to a single sequential file simultaneously, as the programs run at the same time.
Is this possible? If so how can I accomplish this?
Thanks in advance for any help.
Multiple jobs writing to the same sequential file
-
- Global moderator
- Posts: 2105
- Joined: Thu Jun 03, 2010 6:21 pm
- Skillset: Assembler, JCL, utilities
- Referer: zos.efglobe.com
Re: Multiple jobs writing to the same sequential file
Yes, it is possible, but ... the odds are the output will be useless, for several reasons.
- There is no mechanism in z/OS data management to ensure the records will be interleaved in the manner I think you expect.
- In the event the output is directed to a data set on magnetic tape, the second and subsequent programs that attempt to open the data set while the first program has the data set open will be abnormally terminated.
- The end of data for the data set is established by the last program that closes the data set, even if other programs have sent more data to the data set.
- Because of the way z/OS writes data to disks, the slower program may well over write data that faster programs have written to the disk.
-
- Posts: 474
- Joined: Thu Mar 10, 2016 5:03 pm
- Skillset: assembler rexx zOS ispf racf smf
- Referer: saw it in the experts foprum thought I could help here
Re: Multiple jobs writing to the same sequential file
Possible, yes, but complicated.
In assembler I would do something like
test/wait for some agreed-upon resource name then enqueue the resource
open the dataset with the EXTEND option (this allows allocation with disp=shr and still act as if disp=mod was specified)
write
close
dequeue the resource
You need the open and close to flush buffers.
This will be horribly inefficient, but should be safe. And I have no idea if enqueue/dequeue is avaiable for a COBOL program or if the EXTEND option can be used in a COBOL OPEN.
I will much recommend that the programs write to seperate datasets, with a timestamp so that they can be merged afterwards.
In assembler I would do something like
test/wait for some agreed-upon resource name then enqueue the resource
open the dataset with the EXTEND option (this allows allocation with disp=shr and still act as if disp=mod was specified)
write
close
dequeue the resource
You need the open and close to flush buffers.
This will be horribly inefficient, but should be safe. And I have no idea if enqueue/dequeue is avaiable for a COBOL program or if the EXTEND option can be used in a COBOL OPEN.
I will much recommend that the programs write to seperate datasets, with a timestamp so that they can be merged afterwards.
-
- Posts: 2
- Joined: Sat Jan 25, 2020 6:23 am
- Skillset: Beginner Cobol
- Referer: googled mainframe fourm
Re: Multiple jobs writing to the same sequential file
Thank you both for your replies.
It sounds like having the the three programs write to the same sequential file at the same time is too risky. I'll go with the notion of writing to respective files then add an end of night step that merges the the files at the end of night..
It sounds like having the the three programs write to the same sequential file at the same time is too risky. I'll go with the notion of writing to respective files then add an end of night step that merges the the files at the end of night..
-
- Posts: 27
- Joined: Sun Aug 16, 2009 11:07 pm
- Skillset: cobol, db2, application performance tuning
- Referer: SEARCH
- Location: St. Cloud, Minnesota
Re: Multiple jobs writing to the same sequential file
If you have IBM BatchPipes installed, you can have multiple jobs write to the same named pipe and a single SORT COPY job reading from that named pipe and writing to an output file. I've not used BatchPipes recently so best to check the documentation.
Chuck Haatvedt
Chuck Haatvedt
-
- Similar Topics
- Replies
- Views
- Last post
-
-
Multiple remote job entry writing to the same dataset
by MLK2348 » Wed Nov 15, 2023 3:55 am » in JCL - 1
- 2259
-
by willy jensen
View the latest post
Wed Nov 15, 2023 1:50 pm
-
-
-
Merging PDS members into single sequential file.
by jcbrotel » Thu Aug 18, 2022 7:27 pm » in IBM Cobol - 4
- 2907
-
by prino
View the latest post
Fri Aug 19, 2022 11:20 pm
-
-
-
Create multiple records based on one record within a file.
by chillmo » Thu Aug 11, 2022 3:54 am » in Syncsort/Synctool - 5
- 7688
-
by sergeyken
View the latest post
Fri Aug 12, 2022 2:23 am
-
-
- 0
- 1190
-
by stel
View the latest post
Wed Sep 21, 2022 1:06 pm
-
- 0
- 1006
-
by biswajit
View the latest post
Mon Mar 03, 2025 8:54 pm